Closed
Bug 1317867
Opened 8 years ago
Closed 8 years ago
Intermittent devtools/client/netmonitor/test/browser_net_footer-summary.js | leaked 2 window(s) until shutdown [url = about:devtools-toolbox]
Categories
(DevTools :: Netmonitor, defect, P3)
DevTools
Netmonitor
Tracking
(firefox51 unaffected, firefox52 unaffected, firefox53 fixed)
RESOLVED
FIXED
Firefox 53
Tracking | Status | |
---|---|---|
firefox51 | --- | unaffected |
firefox52 | --- | unaffected |
firefox53 | --- | fixed |
People
(Reporter: intermittent-bug-filer, Assigned: jsnajdr)
Details
(Keywords: intermittent-failure)
Attachments
(1 file)
Filed by: philringnalda [at] gmail.com https://treeherder.mozilla.org/logviewer.html#?job_id=6645729&repo=autoland https://archive.mozilla.org/pub/firefox/tinderbox-builds/autoland-win32-debug/1479196153/autoland_win7_vm-debug_test-mochitest-devtools-chrome-1-bm139-tests1-windows-build535.txt.gz
Updated•8 years ago
|
Priority: -- → P3
Comment hidden (Intermittent Failures Robot) |
Comment hidden (Intermittent Failures Robot) |
Comment hidden (mozreview-request) |
Assignee | ||
Comment 4•8 years ago
|
||
How the leak happens: 1. The test require()'s the selectors module and uses it. It doesn't use the module already loaded in the Netmonitor window, but loads its own instance in its own loader. 2. The selectors module contains memoized selectors, i.e., the last returned value is remembered inside the selector. 3. The memoized value keeps a reference to the Netmonitor window. More precisely, the value object contains a function, that function has a closure, and that closure (aka lexical environment) contains the window global. 4. After the test is finished, it checks for window and docshell leaks. At that time, the test tab is closed, the toolbox is closed, too, so all its DOM windows should be gone. 5. But the selectors module is still present in the test loader, so the references to DOM windows still exist - leak detected! How to solve this? Keep a strict distinction between the application code we are testing, and the test code that does the testing. Don't load application modules into the test loader, but use the application loader instead. I'm attaching a patch that fixed the only leak that's happening so far, but we should fix several other tests that aren't leaking yet: - many tests are using the L10N module. Don't load a new instance into the test, but use the already existing instance owned by the application. - as more and more parts are converted to Redux, the tests use the modules for actions and selectors, so that they can trigger actions and inspect the application state. All these modules should be accessed using the application loader. No separate instances in the test loader.
Assignee: nobody → jsnajdr
Comment 5•8 years ago
|
||
mozreview-review |
Comment on attachment 8812120 [details] Bug 1317867 - Fixed window leak in browser_net_footer-summary.js mochitest https://reviewboard.mozilla.org/r/94006/#review94162 Very nice! Thanks for detailed explanation, you could also put a comment directly into the test file. Honza
Attachment #8812120 -
Flags: review?(odvarko) → review+
Assignee | ||
Comment 6•8 years ago
|
||
(In reply to Jan Honza Odvarko [:Honza] from comment #5) > Thanks for detailed explanation, you could also put > a comment directly into the test file. Eventually, every mochitest should use winRequire like this one. Should we explain it everywhere? It's not a one-off exception.
Pushed by jsnajdr@gmail.com: https://hg.mozilla.org/integration/autoland/rev/7d0345ea4344 Fixed window leak in browser_net_footer-summary.js mochitest r=Honza
Comment 8•8 years ago
|
||
(In reply to Jarda Snajdr [:jsnajdr] from comment #6) > (In reply to Jan Honza Odvarko [:Honza] from comment #5) > > Thanks for detailed explanation, you could also put > > a comment directly into the test file. > > Eventually, every mochitest should use winRequire like this one. Should we > explain it everywhere? It's not a one-off exception. Yeah I know. It doesn't make much sense to repeat the same comment in every test, but it would be good to have it somewhere. Perhaps a new mochitest-tips.md file? Honza Honza
Comment 9•8 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/7d0345ea4344
Status: NEW → RESOLVED
Closed: 8 years ago
status-firefox53:
--- → fixed
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → Firefox 53
Updated•8 years ago
|
status-firefox51:
--- → unaffected
status-firefox52:
--- → unaffected
Comment hidden (Intermittent Failures Robot) |
Updated•6 years ago
|
Product: Firefox → DevTools
You need to log in
before you can comment on or make changes to this bug.
Description
•