(latent) permafailing TEST-UNEXPECTED-FAIL | browser/base/content/test/webrtc/browser_devices_get_user_media.js | leaked 1 window(s) until shutdown [url = chrome://browser/content/webrtcLegacyIndicator.xhtml]
Categories
(Firefox :: Toolbars and Customization, defect, P1)
Tracking
()
People
(Reporter: pehrsons, Assigned: pehrsons)
References
(Blocks 1 open bug, Regression)
Details
(Keywords: regression)
Attachments
(1 file)
When re-enabling browser/base/content/test/webrtc/browser_devices_get_user_media.js
for test/webrtc/legacyIndicator
I get on linux-debug locally (and on try (including for other platforms)) the following permafailing errors:
ERROR TEST-UNEXPECTED-FAIL | browser/base/content/test/webrtc/browser_devices_get_user_media.js | leaked 1 window(s) until shutdown [url = chrome://browser/content/webrtcLegacyIndicator.xhtml]
ERROR TEST-UNEXPECTED-FAIL | browser/base/content/test/webrtc/browser_devices_get_user_media.js | leaked 1 window(s) until shutdown [url = about:blank]
These are caused by opening the permissions panel through the legacy indicator. get_user_media_screen.js
exhibits the same issue.
I am getting this with the patches on bug 1775945, but also on m-c.
Assignee | ||
Comment 1•4 months ago
|
||
Did a big effort analyzing this but pernosco and DMD were not much help in this case unfortunately.
The leak is in nsXULPopupManager which is not participating in GC but has a member mNativeMenuSubmenuState
a nsTHashMap<RefPtr<mozilla::dom::Element>, nsPopupState>
where the hash key keeps a strong ref to a dom::Element.
I haven't worked out the exact chain of events but have verified that making the key a rawptr solves the leak. The keys are never accessed directly so as long as the caller of these native menu event handlers keeps a strong ref it should be safe. I'll put it up for review and take it from there.
Assignee | ||
Comment 2•4 months ago
|
||
Sorry, I'll have to backtrack on the regressor. Still looks suspect but for the failing test case this hash map is not used. I had removed a verification thing from a .js file and only did ./mach build binaries
so got a false positive.
Assignee | ||
Comment 3•4 months ago
|
||
It appears to be the _openPopupCancelCallback
from bug 1434883 which captures the entire scope, including the OpenPopupOptions
where triggerEvent
has a strong ref to the webrtcLegacyIndicator.xhtml
window.
OTOH the options with triggerEvent
were added later in bug 1506503 so I guess both combined count as regressors.
Updated•4 months ago
|
Comment 4•4 months ago
|
||
(In reply to Andreas Pehrson [:pehrsons] from comment #3)
It appears to be the
_openPopupCancelCallback
from bug 1434883 which captures the entire scope, including theOpenPopupOptions
wheretriggerEvent
has a strong ref to thewebrtcLegacyIndicator.xhtml
window.OTOH the options with
triggerEvent
were added later in bug 1506503 so I guess both combined count as regressors.
I wonder if this leak is related to bug 1809000 as well - though that is macOS only, and comment 0 suggests that is happening on linux debug.
Comment 5•4 months ago
•
|
||
Assignee | ||
Comment 6•4 months ago
|
||
(In reply to :Gijs (he/him) from comment #4)
I wonder if this leak is related to bug 1809000 as well - though that is macOS only, and comment 0 suggests that is happening on linux debug.
Linux debug is circumstantial. It's what I run locally. The webrtc legacy indicator is disabled on mac in favor of the MacOSWebRTCStatusbarIndicator, but would happen there otherwise. It happens on Windows on try.
I guess it doesn't happen on non-debug because there is no ShutdownLeaks check.
I wonder if bug 180900 could be a result of the stray strongref in comment 1. It can be active when a native popup is showing and was added mac-specifically. I'll comment.
(In reply to :Gijs (he/him) from comment #5)
I'm also confused because that ref (ie to
_openPopupCancelCallback
) gets nulled out here which is called here when the window closes. Does that not happen?
We are just leaking past the ShutdownLeaks check, which happens before the main window is closed (in the callback passed to finish()). See pernosco.
Assignee | ||
Comment 7•4 months ago
|
||
It appears that even a noop function () => {}
will capture the entire scope,
so this patch also changes the normal state of the cancel callback to be
undefined.
Assignee | ||
Comment 8•4 months ago
|
||
pre-patch: https://treeherder.mozilla.org/jobs?repo=try&revision=269b40de773b2d6360be98d74aad3ad4893e8d0c
post-patch: https://treeherder.mozilla.org/jobs?repo=try&revision=06bc67b46f03ed75f90c3390551abd3a634a7233
full desktop b-c suite: https://treeherder.mozilla.org/jobs?repo=try&revision=38369b8a0d5225b6c98f02be813628ddfbb33c6c
Pushed by pehrsons@gmail.com: https://hg.mozilla.org/integration/autoland/rev/83e6cd1dfb3f In PanelMultiView.jsm don't tie the openPopup args to the main window lifetime through the cancelCallback capture. r=Gijs
Comment 11•4 months ago
|
||
bugherder |
Updated•4 months ago
|
Assignee | ||
Updated•4 months ago
|
Description
•