Closed Bug 1636192 Opened 5 years ago Closed 5 years ago

Intermittent dt fission leakcheck | tab 370625 bytes leaked (APZEventState, ActiveElementManager, AsyncFreeSnowWhite, BackstagePass, BrowserChild, ...)

Categories

(DevTools :: General, defect, P5)

defect

Tracking

(firefox78 fixed)

RESOLVED FIXED
Firefox 78
Tracking Status
firefox78 --- fixed

People

(Reporter: intermittent-bug-filer, Assigned: ochameau)

References

(Regression)

Details

(Keywords: intermittent-failure, regression)

Attachments

(1 file)

Filed by: rmaries [at] mozilla.com
Parsed log: https://treeherder.mozilla.org/logviewer.html#?job_id=301235060&repo=autoland
Full log: https://firefox-ci-tc.services.mozilla.com/api/queue/v1/task/ApPYKrUUT8yXdzgMWC5ZSA/runs/0/artifacts/public/logs/live_backing.log


[task 2020-05-07T16:05:00.248Z] 16:05:00 INFO - TEST-START | browser/base/content/test/general/browser_windowactivation.js
[task 2020-05-07T16:05:22.527Z] 16:05:22 INFO - TEST-INFO | leakcheck | tab leaked 5 xpc::CompartmentPrivate
[task 2020-05-07T16:05:22.527Z] 16:05:22 INFO - TEST-UNEXPECTED-FAIL | leakcheck | tab 370625 bytes leaked (APZEventState, ActiveElementManager, AsyncFreeSnowWhite, BackstagePass, BrowserChild, ...)
[task 2020-05-07T16:05:22.528Z] 16:05:22 INFO -
[task 2020-05-07T16:05:22.528Z] 16:05:22 INFO - leakcheck | Processing leak log file c:\users\task_1588865779\appdata\local\temp\tmp5iskn2.mozrunner\runtests_leaks_tab_pid7256.log
[task 2020-05-07T16:05:22.528Z] 16:05:22 INFO -
[task 2020-05-07T16:05:22.528Z] 16:05:22 INFO - == BloatView: ALL (cumulative) LEAK AND BLOAT STATISTICS, tab process 7256
[task 2020-05-07T16:05:22.528Z] 16:05:22 INFO -
[task 2020-05-07T16:05:22.528Z] 16:05:22 INFO - |<----------------Class--------------->|<-----Bytes------>|<----Objects---->|
[task 2020-05-07T16:05:22.528Z] 16:05:22 INFO - | | Per-Inst Leaked| Total Rem|
[task 2020-05-07T16:05:22.528Z] 16:05:22 INFO - 0 |TOTAL | 40 0| 439454 0|
[task 2020-05-07T16:05:22.528Z] 16:05:22 INFO -
[task 2020-05-07T16:05:22.528Z] 16:05:22 INFO - nsTraceRefcnt::DumpStatistics: 1100 entries
[task 2020-05-07T16:05:22.529Z] 16:05:22 INFO - TEST-PASS | leakcheck | tab no leaks detected!
[task 2020-05-07T16:05:22.529Z] 16:05:22 INFO - leakcheck | Processing leak log file c:\users\task_1588865779\appdata\local\temp\tmp5iskn2.mozrunner\runtests_leaks_tab_pid7548.log

The Linux devtools failures start with devtools.browsertoolbox.fission getting set to true in bug 1637012.

Flags: needinfo?(jdescottes)
Regressed by: 1637012

This is quite surprising because:

Are you sure they are related?

Flags: needinfo?(jdescottes)
Flags: needinfo?(poirot.alex)
Regressed by: 1620966
No longer regressed by: 1637012
Has Regression Range: --- → yes
Keywords: regression

Isn't it a duplicated of bug 1607569, which was already close to be a permafail.
I also see bug 1607569's patch in the changelog of comment 7.

The tree herder link in comment 8 makes it look like this failure wasn't happening until your patch landed. I did a few retriggers, and they were green before your patch and orange after.

It looks like the leaking process was created during the test devtools/client/webconsole/test/browser/browser_jsterm_evaluation_context_selector_targets_update.js

I looked at one failure log in bug bug 1607569,, and it was being created during
devtools/client/webconsole/test/browser/browser_console_clear_closed_tab.js

That said, it does look like there are a bunch of other failures getting bundled in here. A lot of them are in mochitest-plain-e10s-5, which is neither devtools nor Fission.

At least in one log I looked at, the mochitest-plain-e10s-5 leak was happening with a content process created while running the tests in dom/security/test/general/

Summary: Intermittent leakcheck | tab 370625 bytes leaked (APZEventState, ActiveElementManager, AsyncFreeSnowWhite, BackstagePass, BrowserChild, ...) → Intermittent dt fission leakcheck | tab 370625 bytes leaked (APZEventState, ActiveElementManager, AsyncFreeSnowWhite, BackstagePass, BrowserChild, ...)
Product: Firefox → DevTools

Thanks for the help Andrew, I was able to repro it locally thanks to your hint.

It looks like my patch is introducing an exception in these two tests leading to leak reports, but without making the test to fail.
We can probably enhance our exception detection while running tests...

I'll have a look at that tomorrow!

Assignee: nobody → poirot.alex
Flags: needinfo?(poirot.alex)

(In reply to Alexandre Poirot [:ochameau] from comment #12)

It looks like my patch is introducing an exception in these two tests leading to leak reports, but without making the test to fail.

Scratch that. I no longer reproduce this exception. The test seems to be running fine.
The leak is related to the page reload when running devtools/client/webconsole/test/browser/browser_console_clear_closed_tab.js.
We should probably leak somethin on page reload in the context of the browser console, but it is hard to guess what.
I tracked the calls to Services.console.registerListener/unregisterListener and it looks correct.

I tried the DMD script (mochitest doesn't accept --mode=scan, so I'm running without), I got the cc-edges logs, but I don't know where to start.
There is no particular address of leaked object/window in mochitest logs.

(In reply to Alexandre Poirot [:ochameau] from comment #13)

Scratch that. I no longer reproduce this exception. The test seems to be running fine.
The leak is related to the page reload when running devtools/client/webconsole/test/browser/browser_console_clear_closed_tab.js.
We should probably leak somethin on page reload in the context of the browser console, but it is hard to guess what.

s/page reload/tab closing/
i.e. this one line

Ok. I think I found it.

We are not trying to do much cleanup when DevTools code is running and the content process is meant to be destroyed.
We just assume that the whole process will be destroyed and do nothing.

If I start listening to "xpcom-shutdown" and destroy DevTools listeners (including the various console related ones: Services.console and Services.obs.addObserver(console-api-log-event)), the leak goes away (locally at least).

I'm not sure bug 1620966 changed anything around this. This leak was probably around for a while!

Before this patch, we were not trying to cleanup anything when the process
was known to be in process of destruction. We assumed that everything would
be cleaned up anyway.
But mochitest is actually asserting that nothing is leaked on process shutdown,
and we are easily leaking many thing when not destroying the target actor!

(In reply to Alexandre Poirot [:ochameau] from comment #15)

If I start listening to "xpcom-shutdown" and destroy DevTools listeners (including the various console related ones: Services.console and Services.obs.addObserver(console-api-log-event)), the leak goes away (locally at least).

The problem with this is that if this DevTools stuff is holding references to web pages then it means we may be leaking pages until shutdown, which is bad. So your proposed fix would only be hiding leaks from the leak checker, not fixing them. The leak here is a window and a document.

That said, we have a different checker for leaked windows and documents in browser mochitests, and I thought devtools mochitests used that, so I'm not sure why it wouldn't be detected with that. I'll try to figure out what window is leaking.

(In reply to Andrew McCreight [:mccr8] from comment #18)

(In reply to Alexandre Poirot [:ochameau] from comment #15)

If I start listening to "xpcom-shutdown" and destroy DevTools listeners (including the various console related ones: Services.console and Services.obs.addObserver(console-api-log-event)), the leak goes away (locally at least).

The problem with this is that if this DevTools stuff is holding references to web pages then it means we may be leaking pages until shutdown, which is bad. So your proposed fix would only be hiding leaks from the leak checker, not fixing them. The leak here is a window and a document.

Let me rephrase.
DevTools cleans things up when it closes itself! When DevTools closes, we go through all processes and try to cleanup all our stuff everywhere.
(We might have bugs in this process, but I haven't identified a bug in this here. And we really meant to clean everything.)
But while it is opened, if one content process shuts down, DevTools doesn't try to cleanup anything, it just let the process be destroyed and assume everything will be cleaned up. Is that really an issue to leak something when we know the process is in process of shutting down?

To be slightly more concrete about what I identified here. We were destroying all DevTools "Targets actors" for all content processes, all but the one related to the closed tab, which is closed in middle of the test, while DevTools are opened. All others were explicitely destroyed by DevTools code when we are closing the Browser Console.
"Target actors" are the topmost class in DevTools backend, which holds everything alive.

Pushed by apoirot@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/d45a9f533b34 Clean Content process Target actor on process shutdown. r=nchevobbe

(In reply to Alexandre Poirot [:ochameau] from comment #17)

https://treeherder.mozilla.org/#/jobs?repo=try&revision=b5a7386ad50bfe04c6ae2843bee87ce86d6e66f9

Looking at this try run, while I fixed a leak locally, it doesn't seem to address the leak happening on try.
I pushed this first patch and I'll keep watching this bug.

Pushed by apoirot@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/0c1e8493381e Clean Content process Target actor on process shutdown. r=nchevobbe
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 78
See Also: → 1641824
Flags: needinfo?(poirot.alex)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: