Repository navigation
Add diagnostic logging and 3m ToolExit timeout for web test hangs - #191004
Conversation
|
It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging. If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group. |
There was a problem hiding this comment.
Code Review
This pull request introduces a diagnostic hang reporting mechanism for Flutter web tests, implementing watchdog timers to detect timeouts and a CdpNetworkTracker to track active network requests via the Chrome DevTools Protocol. Feedback on these changes identifies two issues: first, watchdog timers are only cancelled when the test suite finishes, which can trigger false-positive timeouts for long-running suites; second, the diagnostic logic incorrectly requires active WebSocket traffic to identify stalled asset fetches or JS execution, which prevents accurate diagnosis when the browser is hung and the WebSocket is inactive.
|
This pull request executed golden file tests, but it has not been updated in a while (20+ days). Test results from Gold expire after as many days, so this pull request will need to be updated with a fresh commit in order to get results from Gold. For more guidance, visit Writing a golden file test for Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces watchdog timers (a 45-second warning and a 3-minute hard timeout) to diagnose and handle potential test suite timeouts or browser hangs during web test loading, along with a CdpNetworkTracker to track active network requests via the Chrome DevTools Protocol. The review feedback highlights critical issues where unhandled exceptions in the diagnostic calls could crash the test runner or prevent the timeout from completing, and suggests wrapping these calls in try-catch blocks. Additionally, the new public class CdpNetworkTracker and its members require documentation to align with the repository style guide.
|
Golden file changes have been found for this pull request. Click here to view and triage (e.g. because this is an intentional change). If you are still iterating on this change and are not ready to resolve the images on the Flutter Gold dashboard, consider marking this PR as a draft pull request above. You will still be able to view image results on the dashboard, commenting will be silenced, and the check will not try to resolve itself until marked ready for review. For more guidance, visit Writing a golden file test for Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces watchdog timers and a diagnostic hang reporter to detect and debug test suite timeouts or browser hangs in FlutterWebPlatform, utilizing a new CdpNetworkTracker to monitor active network requests. Feedback on these changes highlights a potential race condition and subscription leak in CdpNetworkTracker if dispose is called during asynchronous initialization, and recommends replacing DateTime.now with clock.now to facilitate unit testing.
harryterkelsen
left a comment
There was a problem hiding this comment.
LGTM with small nit
When a web test suite hangs while loading in
flutter test --platform chrome,FlutterWebPlatform.load()waits indefinitely until the CI job hits its global timeout, with no logs showing whether the browser froze, JS execution stalled in the test iframe, or an asset fetch got stuck.To fail fast and make issues like the
canvaskit.wasmloading hang (fixed in #190155) quick to identify:Network.enable) inCdpNetworkTrackerso we know which requests are still pending and for how long.BrowserManager.diagnoseHang()to check WebSocket activity, probe CDP responsiveness (Runtime.evaluate), and list network requests pending for ≥5s._browserManager!.load()that logs the diagnostic report after 45 seconds and aborts with aToolExitafter 3 minutes.