Reading issue
← Back to microsoft/playwright
microsoft / playwright · Issue No. 41900
1.61.1
Steps:
import http from 'node:http';
import { test as base } from '@playwright/test';
function createServer(): Promise<{ url: string; close: () => void }> {
return new Promise((resolve) => {
const server = http.createServer((_req, res) => {
res.writeHead(200, { 'content-type': 'text/html' });
res.end('<html><body>ok</body></html>');
});
server.listen(0, '127.0.0.1', () => {
const port = (server.address() as { port: number }).port;
resolve({ url: `http://127.0.0.1:${port}`, close: () => server.close() });
});
});
}
const test = base.extend<{ origins: [string, string] }>({
async origins({}, use) {
const a = await createServer();
const b = await createServer();
await use([a.url, b.url]);
a.close();
b.close();
},
});
test.describe('page.close() race with cross-origin navigation commit', () => {
for (let i = 0; i < 30; i++) {
test(`attempt ${i}`, async ({ context, origins: [originA, originB] }) => {
test.setTimeout(10_000);
const page = await context.newPage();
await page.goto(originA);
// Cross-origin nav: A → B
page.goto(originB).catch(() => {});
await new Promise((r) => setTimeout(r, 10));
// Cross-origin nav: B → A (second RFH swap)
page.goto(originA).catch(() => {});
// Races with the second commit — hangs sometimes
await page.close();
});
}
});
All tests pass
Some tests time out, hanging on the page.close()
Probably caused by https://issues.chromium.org/issues/536385539 which is presumably also the cause of https://github.com/microsoft/playwright/pull/41695.
System:
OS: Linux 6.18 Ubuntu 22.04.5 LTS 22.04.5 LTS (Jammy Jellyfish)
CPU: (12) x64 13th Gen Intel(R) Core(TM) i7-1365U
Memory: 11.55 GB / 15.45 GB
Container: Yes
Binaries:
Node: 24.14.0 - /mnt/wslg/runtime-dir/fnm_multishells/<redacted>/bin/node
Yarn: 1.22.22 - /mnt/wslg/runtime-dir/fnm_multishells/<redacted>/bin/yarn
npm: 11.16.0 - /mnt/wslg/runtime-dir/fnm_multishells/<redacted>/bin/npm
pnpm: 10.13.1 - /home/<redacted>/.local/share/pnpm/pnpm
IDEs:
VSCode: 1.129.1 - /mnt/c/Users/<redacted>/AppData/Local/Programs/Microsoft VS Code/bin/code
Languages:
Bash: 5.1.16 - /usr/bin/bash
npmPackages:
@playwright/test: 1.61.1 => 1.61.1
Relay reads this issue against the repository's contribution signals: the files it is likely to touch, how the maintainers triage work this size, and what the first contribution would exercise.
The full analysis for this issue is still being assembled. Until then, the description above and the thread on GitHub are the most reliable context.