Closed Bug 1630254 Opened 4 years ago Closed 4 years ago

Run tasks after every shutdown cycle collection

Categories

(Core :: XPCOM, task, P2)

task

Tracking

()

RESOLVED FIXED
mozilla77
Tracking Status
firefox77 --- fixed

People

(Reporter: mccr8, Assigned: mccr8)

References

Details

Attachments

(2 files)

Unlinking, such as in UnbindFromTree, can add runnables that keep alive CCed objects after they have been unlinked. In combination with some unknown fields not being traversed and unlinked this could cause intermittent shutdown leaks, if those unknown fields hold alive objects that need the CC to be collected. Work around this by clearing out these runnables after every shutdown CC.

See bug 1596532 comment 72.

I tried reading code related to video elements to find what might be missing, but I didn't see anything obvious. There's a lot of classes that can't be CCed because they use threadsafe refcounting, so maybe one of them can hold a video element alive somehow. This will probably be tough to figure out without DMD heap scan and CC logs that hit the leak in bug 1596532. I think I tried to do that, but the DMD slowdown was probably making it hard to repro.

Clearing the queue after every CC is a bit of a hack, but at least the leak didn't show up after 16 retriggers: https://treeherder.mozilla.org/#/jobs?repo=try&revision=82f9aa12ff4af527e6f04318dee82ba88a8b492f

The rate of this failure isn't super high normally so it is hard to say if it is really doing the trick.

This is to prepare for the next patch.

Unlinking, such as in UnbindFromTree, can add runnables that keep alive CCed
objects after they have been unlinked. In combination with some unknown
fields not being traversed and unlinked this could cause intermittent shutdown
leaks, if those unknown fields hold alive objects that need the CC to be
collected. Work around this by clearing out these runnables after every
shutdown CC.

Pushed by amccreight@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/80822f4dcf6f
part 1 - Make nsCycleCollector::Shutdown MOZ_CAN_RUN_SCRIPT. r=smaug
https://hg.mozilla.org/integration/autoland/rev/4beaa3c7e5c3
part 2 - Run tasks after every shutdown cycle collection. r=smaug
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla77
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: