[Bug]: Playwright.Dispose() can hang forever while the driver is still sending messages
I maintainer di solito rispondono entro 1 giorno
Una pull request collegata è già stata integrata.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 54/100
Direzione di ricerca
Start by reading StdIOTransport.Close, the TransportClosed listener, and the _readerCancellationSource.Cancel() call mentioned in the report. Trace how closing stdin, reading stdout, and waiting for the driver interact when the stdout pipe fills on Windows; reproduce with the supplied busy-page example or the blocking stdout setup described. Done means Dispose() returns after the driver exits without deadlocking, and transport closure does not throw ObjectDisposedException.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Version
1.64.0, also current main
Steps to reproduce
Dispose Playwright while the driver is still sending protocol messages, for example events from a busy page:
var playwright = await Playwright.CreateAsync();
var browser = await playwright.Chromium.LaunchAsync();
var page = await browser.NewPageAsync();
page.Console += (_, _) => { };
await page.EvaluateAsync("() => { setInterval(() => { for (let i = 0; i < 200; i++) console.log('x'.repeat(20000)); }, 0); }");
await Task.Delay(500);
playwright.Dispose();
The same happens when Dispose() is called from inside an event handler.
Expected behavior
Dispose() returns once the driver has exited.
Actual behavior
Dispose() never returns. The thread is blocked in StdIOTransport.Close → Process.WaitForExit.
StdIOTransport.Close stops reading the driver's stdout, closes its stdin and waits for the process to exit. The driver exits when its event loop sees stdin closed. On Windows, Node.js writes to a piped stdout synchronously, so a driver that is in the middle of writing blocks as soon as the pipe is full. It never gets to the stdin handler, nor to its own 30 second exit timer, and each side waits for the other.
On Linux and macOS the driver writes to the pipe asynchronously, so it sees stdin closed and exits; there is no hang there.
Additional context
Reported with a fix in #3380, where a downstream testhost dump shows the thread blocked in StdIOTransport.Close / Process.WaitForExit.
I have not run the snippet on Windows. On macOS it hangs every time when the driver's stdout is switched to blocking mode with process.stdout._handle.setBlocking(true), which is what Node.js does for a pipe on Windows, and it does not hang without that.
Since #3307 there is a related defect in the same method: TransportClosed is raised first, its listener disposes the transport, and the following _readerCancellationSource.Cancel() throws ObjectDisposedException when the transport closes on its own, for example after the driver exits.
- Lingua principale
- C#
- Stelle
- 3k
- Fork
- 307
- Merge medio
- 1g 14h
- PR unite (30g)
- 32
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-dotnet
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
microsoft/playwright-dotnet#3432 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
microsoft/playwright-dotnet#3426 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
microsoft/playwright-dotnet#3446 ·
I maintainer di solito rispondono entro 1 giorno
-
[Epic-Ideas-from-Alex] Playwright Test parity for .NET: one roadmap for the test-runner featuresAperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 20/100
microsoft/playwright-dotnet#3444 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
microsoft/playwright-dotnet#3443 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di microsoft/playwright-dotnet
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
RadicalCSG/com.chisel#312 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 63/100
DeveloperAcademy-POSTECH/2026-C6-M10-MUSA#677 ·
I maintainer di solito rispondono entro 1 giorno
-
REQ-13 : une demande En cours perd son responsable par un simple enregistrement, et reste En coursApertaa-corriger bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
christian-raj/S-Aloha#301 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
.NET Docs Next Major State: Needs Discussion
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
getsentry/sentry-dotnet#5912 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno