Repository navigation
Description
Steps to reproduce
Intermittent; no deterministic repro. On GitHub-hosted ubuntu-latest runners:
- Run
flutter test --platform chrome <tests>in a package with web tests. - All tests pass and package:test reports success (JSON reporter
donewithsuccess: true). - The
flutterprocess does not exit and the CI job runs until its timeout.
Expected results
The process exits once the tests are done.
Actual results
The process hangs after success was reported. The exit code is already set by executable.dart before runner.close(), so the hang is in browser shutdown.
flutter_tools/lib/src/web/chrome.dart (lines 571-572 at 6655482) does:
await tab.connect();
await wipConnection.sendCommand('Browser.close');There is no timeout and no fallback to killing the process. In webkit_inspection_protocol 1.2.1, _handleClose closes its streams but never completes the pending _completers (webkit_inspection_protocol.dart:251,264-299). If Chrome exits before its Browser.close reply arrives, the future never completes and Browser.close never returns.
Suggested fix, either or both:
- Bound the
Browser.closewait with a timeout and fall back to killing the Chrome process. - Complete pending completers with an error when the connection closes in
webkit_inspection_protocol.
Seen in leehack/llamadart#1702.
Code sample
Not applicable; the hang is in tool shutdown after tests pass.
Logs
Not applicable; the log ends after the reporter's final done event with success: true and nothing further is printed.
Flutter Doctor output
Reproduced in CI on Flutter 3.47.1 (commit 6655482). The full flutter doctor -v is not attached because the hang was observed on CI runners.
Flutter 3.47.1 • channel [user-branch] • revision 6655482ec0 (3 months ago) • 2026-08-19 10:07:23 -0700
Engine • hash 11d79658c444477b06513d32b52c8c4ccb7276b0 (revision 5d53178869) • 2026-08-18
Activity
mbcorona commentedon Nov 9, 2026
Thanks for the analysis @leehack.
Routing to the tool team to review the PR.
leehack commentedon Nov 9, 2026
Opened the package-side fix as well: google/webkit_inspection_protocol.dart#143. It fails pending
sendCommandfutures with aStateErrorwhen the connection closes, soBrowser.closecan no longer wait forever on a reply that will never arrive.It complements #196211 rather than replacing it: the timeout in
Chromium.closestill covers the case where Chrome stays alive but never answers, and it does not depend on a new package release being rolled in.[flutter_tools] Bound Browser.close in Chromium.close (flutter#196211)