Closed Bug 2020270 Opened 8 months ago Closed 8 months ago

ShutdownLeakPathFinder doesn't run when a test in the manifest times out

Categories

(Testing :: Mochitest, enhancement)

enhancement

Tracking

(firefox150 fixed)

RESOLVED FIXED
150 Branch
Tracking Status
firefox150 --- fixed

People

(Reporter: florian, Assigned: florian)

References

Details

Attachments

(1 file, 1 external file)

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 on Tester to avoid code duplication between the normal and timeout paths.
  • Call _shutdownCleanup + _checkForLeakedWindows from the timeout handler before calling finish(), 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).

This is what I used to verify locally that the patch produces the expected behavior.

Status: ASSIGNED → RESOLVED
Closed: 8 months ago
Resolution: --- → FIXED
Target Milestone: --- → 150 Branch
See Also: → 2072901
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: