Skip to content
This repository was archived by the owner on Jan 30, 2025. It is now read-only.
This repository was archived by the owner on Jan 30, 2025. It is now read-only.

Deadlock in FrameManager's frameNavigated when we navigate to certain websites #941

@ankur22

Description

@ankur22

Brief summary

A deadlock occurs when we navigate to certain websites, and perform a click action which results in another navigation.

xk6-browser version

v0.10.0

OS

NA

Chrome version

NA

Docker version and image (if applicable)

NA

Steps to reproduce the problem

When this script is ran, it deadlocks after the click occurs.

import { chromium } from 'k6/experimental/browser';

export default async function () {
  const browser = chromium.launch({
    headless: false,
  });
  const page = browser.newPage();

  try {
    await page.goto('https://near.org/', { waitUntil: 'networkidle' });

    console.log('About to click on sign-in');

    await Promise.all([
      page.waitForNavigation({ waitUntil: 'networkidle' }),
      page.locator('button[class="sign-in"]').click(), // <- deadlocks on a navigation caused by this click
    ]);

    console.log('click on sign-in done');
  } finally {
    await page.close();
    await browser.close();
  }
}

The exact reason as to why this particular website is causing this issue is unknown, but there is a hierarchy of frames. When a navigation completes, we sometimes need to remove child frames. During this removal of child frames, we see a deadlock. The reason for this is due to the m.framesMu lock being held in FrameManger.frameNavigated here, and when it calls removeFrameRecursively it deadlocks here waiting for m.framesMu.

Expected behaviour

The script completes after navigating to the sign in page.

Actual behaviour

The script hangs after the navigation occurs to the sign in page.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinguser requestRequested by the community

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions