ShutdownLeakPathFinder doesn't run when a test in the manifest times out
Categories
(Testing :: Mochitest, enhancement)
Tracking
(firefox150 fixed)
| Tracking | Status | |
|---|---|---|
| firefox150 | --- | fixed |
People
(Reporter: florian, Assigned: florian)
References
Details
Attachments
(1 file, 1 external file)
|
2.56 KB,
patch
|
Details | Diff | Splinter Review |
The changes landed in bug 2019756 gave some interesting information already (see bug 1932653 comment 74 for example), but disappointingly in most cases we still see only the "leaked 1 window(s) until shutdown" message from the python leak checking. After investigating a bit, it seems the new leak path finder code path doesn't run when there's a timeout happening later in the same manifest (eg https://share.firefox.dev/4aTMg3m).
This is because ShutdownLeakPathFinder only runs in the end-of-manifest shutdown cleanup path inside nextTest(). When a test times out (with timeoutAsPass=false, which is the default), the timeout handler calls Tester.finish() directly, bypassing nextTest() entirely. So if an earlier test in the manifest leaked a window and a later test times out, the leak path finder never runs.
Fix:
- Extract
_shutdownCleanup()and_checkForLeakedWindows()as methods onTesterto avoid code duplication between the normal and timeout paths. - Call
_shutdownCleanup+_checkForLeakedWindowsfrom the timeout handler before callingfinish(), with a single GC/CC pass (the normal path does two rounds with a 1s delay between them, but that's unnecessary here since we're just detecting leaks from earlier tests, not cleaning up after a graceful shutdown). - Exclude windows from the timed-out test itself, since it didn't get a chance to clean up and those would be false positives (that's an improvement over the behavior of the python code).
| Assignee | ||
Comment 1•8 months ago
|
||
This is what I used to verify locally that the patch produces the expected behavior.
| Assignee | ||
Comment 2•8 months ago
|
||
Description
•