Closed Bug 1379957 Opened 7 years ago Closed 7 years ago

DOM workers continue to run idle GCs every few seconds when idle

Categories

(Core :: DOM: Workers, enhancement)

55 Branch
enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla56
Tracking Status
firefox56 --- fixed

People

(Reporter: jonco, Assigned: jonco)

References

Details

Attachments

(1 file)

Something I noticed a while ago is that DOM worker threads periodically GC even when the browser is totally idle due to IdleGCTimerCallback running repeatedly.  

I tracked this down to the DebuggerOnGCRunnable which is enqued from CycleCollectedJSRuntime::GCSliceCallback.  This happens at the end of GC and makes the worker run loop think that the worker is active again and restarts the idle GC timer.

Ideally we would ignore events associated with GC when deciding whether the worker is idle but I don't know how feasible that is.  A simpler mitigation would be to skip enqueuing this runnable if there were no debuggers active.
Nick, any ideas on how best to proceed?
Flags: needinfo?(nfitzgerald)
> A simpler mitigation would be to skip enqueuing this runnable if there were no debuggers active.

This one sounds more appealing to me, FWIW.
I think Olli was trying to make some worker GC changes recently as well.  He might have opinions.
GC/CC scheduling on workers is totally busted, and when I tried to fix it, it always caused test failures :(

But definitely debugger code shouldn't make the behavior worse.
(In reply to Jon Coppeard (:jonco) from comment #0)
> A simpler mitigation would be to skip enqueuing this runnable
> if there were no debuggers active.

Yeah, there's no point in posting this runnable if there aren't any debuggers observing any global within the set of zones being collected.compartment
Flags: needinfo?(nfitzgerald)
Patch to check whether there are any debuggers that will have their onGarbageCollect hooks fired before dispatching the runnable.
Assignee: nobody → jcoppeard
Attachment #8885717 - Flags: review?(nfitzgerald)
Comment on attachment 8885717 [details] [diff] [review]
bug1379957-only-fire-ongc-hook-when-necessary

Review of attachment 8885717 [details] [diff] [review]:
-----------------------------------------------------------------

Looks great :) Thanks!
Attachment #8885717 - Flags: review?(nfitzgerald) → review+
Pushed by jcoppeard@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/872e9c8fec61
Only fire the debugger's onGarbageCollection hook when necessary to avoid extra worker GCs r=fitzgen
https://hg.mozilla.org/mozilla-central/rev/872e9c8fec61
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla56
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: