[Bug]: page.goto never returns for a load started as a newer service worker takes over (Chromium)
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 12/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- javascript, typescript
- Ambito
- testing-qa
Direzione di ricerca
The hang sits in the Chromium driver's handling of Page.navigate when a service worker takes over mid-load, so start from the navigation code in the Chromium backend of the playwright repository and the protocol log in the reproduction repo (protocol-log-hung-run.txt). Run repro.mjs repeatedly to reproduce it, then compare against the direct DevTools protocol scenario. Done would mean page.goto resolves in the takeover case without changing the reproduction's expected timings.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Version
1.65.1 (latest release); also 1.66.0-alpha-2026-11-20 (next)
Steps to reproduce
- Clone https://github.com/MorrisonWill/playwright-sw-takeover-goto-hang
npm installnpx playwright install chromiumfor i in 1 2 3 4 5 6 7 8 9 10; do node repro.mjs; done- Each run prints
loaded /after in N ms(exit 0) orthe load did not finish: TimeoutError: page.goto: Timeout 15000ms exceeded.(exit 1). About half or more of the runs hang.
repro.mjs is one file with no dependency besides playwright-core. It serves a tiny site whose service worker answers page loads from navigation preload, else fetch, else an offline page. Tab one starts a load the server holds, so worker 1 stays busy. The server then serves worker 2, which installs and waits (it called skipWaiting). When the held load is answered, worker 2 takes over and worker 1 is stopped. A page.goto started in tab two at that moment is the one that hangs.
Expected behavior
page.goto(origin + "/after") resolves once the page loads (worker 2 answers it, or the browser falls back to the network), as it does every time when the same steps are driven over the DevTools protocol without Playwright.
Actual behavior
page.goto never returns. Playwright's Page.navigate gets no answer until the browser is closed (then net::ERR_ABORTED), the frame never commits, and the Page object stops working: page.evaluate fails with "Target page, context or browser has been closed", although no close event is emitted and the page is no longer in context.pages().
The navigation preload response for that load arrives (200, loading finished) while it hangs. Chromium reports the old worker's target as crashed (Inspector.targetCrashed), which it does on every takeover when a client is attached, hang or not.
How often, same scenario:
| Driver | The load hangs |
|---|---|
repro.mjs, Playwright 1.65.1, Ubuntu 24.04, Node 24 |
5 of 10 |
repro.mjs, Playwright 1.65.1, a second machine (Arch-based Linux 7.2, Node 26) |
7 of 10 |
Playwright 1.65.1, page.goto, in a fuller probe |
6 to 7 of 10, and 16 of 20 |
Playwright 1.66.0-alpha-2026-11-20, page.goto |
5 of 10 |
Playwright 1.65.1 with PLAYWRIGHT_DISABLE_SERVICE_WORKER_NETWORK=1 |
3 of 10 |
The DevTools protocol directly (own WebSocket, Target.createTarget, Page.navigate, Page.loadEventFired) |
0 of 12 |
Directly, auto-attached to all targets (Target.setAutoAttach, flatten) |
0 of 15 |
Directly, auto-attached with waitForDebuggerOnStart: true, each target resumed with Runtime.runIfWaitingForDebugger |
0 of 15 |
| As above, and page-level service worker sessions detached at once | 0 of 15 |
As above, and Network.enable on pages and workers |
0 of 15 |
Under Playwright, the same load started other ways does not hang (20 runs each, in ways-to-load.txt): page.evaluate(() => location.href = url) then page.waitForURL(url, { waitUntil: "load" }): 0 of 20; a context.newCDPSession(page) doing Page.navigate and waiting for Page.loadEventFired: 0 of 20. A locator.click() on a link that navigates across the same takeover hung once in 65 rounds ("waiting for scheduled navigations to finish").
From DEBUG=pw:protocol of a run that hangs (the whole log is protocol-log-hung-run.txt in the repository; session 612083F7... is the second tab, 7041D190... is worker 1):
20:28:00.958Z SEND {"id":79,"method":"Page.navigate","params":{"url":"http://127.0.0.1:40365/after","frameId":"8EF0890A...","referrerPolicy":"unsafeUrl"},"sessionId":"612083F7..."}
20:28:00.959Z RECV Page.frameStartedNavigating {"frameId":"8EF0890A...","url":"http://127.0.0.1:40365/after","navigationType":"differentDocument"}
20:28:00.960Z RECV Network.requestWillBeSent (the navigation, loader 99073655...)
20:28:00.965Z RECV Network.requestWillBeSent {"requestId":"preload-9", ... "/after"} (navigation preload, on worker 1's session)
20:28:00.965Z RECV Network.responseReceived {"requestId":"preload-9", "status":200}
20:28:00.965Z RECV Network.loadingFinished {"requestId":"preload-9"}
20:28:00.967Z RECV {"method":"Inspector.targetCrashed","params":{},"sessionId":"7041D190..."} (worker 1)
20:28:00.967Z RECV Target.detachedFromTarget {"sessionId":"7041D190...","targetId":"571988D4..."}
... service worker targets attached and detached (worker 2) ...
(nothing for frame 8EF0890A... after this: no frameNavigated, no commit, no load)
20:28:15.968Z SEND Runtime.evaluate ... (the test's own check, which then fails: target closed)
20:29:20.202Z RECV {"id":79,"result":{"frameId":"8EF0890A...","loaderId":"99073655...","errorText":"net::ERR_ABORTED"}} (only when the browser is closed)
Additional context
Found while making an installed-app (PWA) end-to-end test reliable: it failed in about 3 of 50 CI runs at a page.goto started while a deploy brought in a new worker. The site's own worker is not the cause, since the direct protocol runs above load every time. I did not find an existing issue for this; the nearest are WebKit and Firefox navigation hangs.
I do not intend to work on a fix myself. The investigation and this report were prepared with the help of an AI coding agent; the reproduction was run on two machines and the numbers above are from those runs.
Environment
System:
OS: Linux 6.8 Ubuntu 24.04 (x64); also Linux 7.2, Arch-based (x64)
Binaries:
Node: 24.22.2; also 26.12.0
npm: 11.20.0
npmPackages:
playwright-core: 1.65.1
Browser:
Chromium 1255 from Playwright's download (Chrome for Testing 159.0.8154.6), headless
- Lingua principale
- TypeScript
- Stelle
- 100k
- Fork
- 6.9k
- Merge medio
- 16h 8m
- PR unite (30g)
- 281
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di microsoft/playwright
-
[MCP]: page snapshots in .playwright-mcp/ are not git-ignored (.playwright-cli/ is, since #42318)Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
microsoft/playwright#44289 ·
I maintainer di solito rispondono entro 1 giorno
-
agent-triage-done
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
microsoft/playwright#44264 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
[BUG] WebKit keeps every removed iframe's JS heap alive (memory grows until the page crashes)Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 12/100
microsoft/playwright#44290 ·
I maintainer di solito rispondono entro 1 giorno
-
[Regression]: requestFullscreen() in a popup rejects with "not granted" in 1.65 (Chromium 159)Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 22/100
microsoft/playwright#44288 ·
I maintainer di solito rispondono entro 1 giorno
-
[MCP] browser_tabs list/select indices diverge across HTTP sessions with --shared-browser-contextAperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 22/100
microsoft/playwright#44279 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di microsoft/playwright
Issue simili
-
good first issue
Difficoltà 2/5 Mezza giornata Idoneità per principianti 65/100
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
blamechris/chroxy#9272 ·
I maintainer di solito rispondono entro 1 giorno
-
no-repo-link tool-submission
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 66/100
BraveOPotato/NoSignups#2458 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
drmrd/vernacular#1061 ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug] PUT /profiles/{id} silently drops design_prompt — designed voice profiles cannot be editedAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100