Closed Bug 863447 Opened 11 years ago Closed 11 years ago

Allow some time to complete async work if nsGlobalWindow appears leaked

Categories

(Testing :: Mochitest, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla23

People

(Reporter: mak, Assigned: mak)

References

Details

Attachments

(1 file)

By introducing the first indexedDB mochitest browser test in bug 861308, I found that indexedDB keeps mainthread objects alive until pending off main-thread work is complete. This may last a few milliseconds, though it totally confuses our leak detection, that runs as soon as the test completes.
This is a case I found, but I can easily see it may happen in other cases, especially now that we move towards more multi-threaded components, it may even be cause of some intermittent reported leaks.

I suggest when a leak is detected we "sleep" a small timeframe (I suggest 1s) and then we retry the leak checking.  This is not a perfect solution (we can't detect easily work completion on other threads), but should improve the situation without increasing much the time since it acts only when a globalwindow leak is detected.

I will try making the change and see how it behaves in the indexedDB case.
Attached patch patch v1.0Splinter Review
Attachment #739512 - Flags: review?(ttaubert)
oh, well, looks like I must fix something in aboutHome.js, though should be part of bug 789348, I will do another try with just this patch.
Comment on attachment 739512 [details] [diff] [review]
patch v1.0

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

Sounds reasonable to me as we're only waiting for a second when detecting a leak (which is the exception). Maybe we could also kick off a GC right before analyzing the CC graph again. smaug suggested doing this in another patch I was writing but I can't exactly remember why. Shouldn't hurt, though.

Also, <3 fat arrow functions.
Attachment #739512 - Flags: review?(ttaubert) → review+
(In reply to Tim Taubert [:ttaubert] from comment #4)
> Maybe we could also kick off a GC right
> before analyzing the CC graph again.

afaict the analyzer already runs 3 gc before analyzing, am I wrong?
(In reply to Marco Bonardo [:mak] from comment #5)
> (In reply to Tim Taubert [:ttaubert] from comment #4)
> > Maybe we could also kick off a GC right
> > before analyzing the CC graph again.
> 
> afaict the analyzer already runs 3 gc before analyzing, am I wrong?

Right! Was just testing you, carry on :)
https://hg.mozilla.org/mozilla-central/rev/bed3081376ca
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Depends on: 932898
Component: BrowserTest → Mochitest
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: