ActionButton leaks existing windows through sdk/tab/events and sdk/window/events

RESOLVED FIXED in Firefox 49

Status

RESOLVED FIXED
2 years ago
2 years ago

People

(Reporter: bkelly, Assigned: bkelly)

Tracking

unspecified
mozilla50
Dependency tree / graph

Firefox Tracking Flags

(firefox47 wontfix, firefox48 wontfix, firefox49 fixed, firefox-esr45 wontfix, firefox50 fixed)

Details

(Whiteboard: [MemShrink])

Attachments

(4 attachments, 1 obsolete attachment)

(Assignee)

Description

2 years ago
+++ This bug was initially created as a clone of Bug #1267693 +++

The mozilla-tree-status addon still causes leaks.  This time its coming through the sdk/tab/events module:

000001B6C7C54380 [Sandbox 1b6c8050178]
    --[group]--> 000001B6C7CE70A0 [object_group]
    --[group_proto]--> 000001B6C832B320 [Proxy <no private>]
    --[private]--> 000001B6C756D780 [Object <no private>]
    --[require]--> 000001B6C7CE86C0 [Function require]
    --[fun_environment]--> 000001B6C00F4E20 [Call <no private>]
    --[loader]--> 000001B6BD08A480 [Object <no private>]
    --[sandboxes]--> 000001B6BD0A9A60 [Object <no private>]
    --[resource://gre/modules/commonjs/sdk/tab/events.js]--> 000001B6C18F5720 [Proxy <no private>]
    --[private]--> 000001B6C18F56A0 [Proxy <no private>]
    --[private]--> 000001B6C7C54420 [Sandbox 1b6c708f7d8]
    --[interactiveWindows]--> 000001B6C7F665E0 [Proxy <no private>]
    --[private]--> 000001B6C7F6B580 [Array <no private>]
    --[objectElements[1]]--> 000001B6C18F53C0 [Proxy <no private>]
    --[private]--> 000001B6C2B26040 [Proxy <no private>]
    --[private]--> 000001B6C2B15060 [Window <no private>]

This is getting pulled in from sdk/ui/state/events which is in turn pulled in through the ActionButton.
(Assignee)

Updated

2 years ago
Assignee: nobody → bkelly
Status: NEW → ASSIGNED
(Assignee)

Comment 1

2 years ago
This leaks windows open when the addon is loaded.
(Assignee)

Comment 2

2 years ago
Created attachment 8773330 [details] [diff] [review]
P2 Test that sdk/tab/events does not leak. r=gabor

This test provokes the leak.
(Assignee)

Comment 3

2 years ago
Actually, there is a leak of existing windows in sdk/window/events as well. <sigh>
Summary: ActionButton leaks windows through sdk/tab/events → ActionButton leaks existing windows through sdk/tab/events and sdk/window/events
(Assignee)

Comment 4

2 years ago
Created attachment 8773428 [details] [diff] [review]
P3 Test that sdk/tab/events does not leak. r=gabor

Updated with actual test contents.
Attachment #8773330 - Attachment is obsolete: true
(Assignee)

Comment 5

2 years ago
Created attachment 8773429 [details] [diff] [review]
P4 Test that sdk/window/events does not leak existing windows. r=gabor

Test that demonstrates the window/events leaks.
It might be a better use of your time helping erahm out with test failures in bug 1276366. ;)

That should fix all of these leaks.
(Assignee)

Comment 7

2 years ago
(In reply to Andrew McCreight [:mccr8] from comment #6)
> It might be a better use of your time helping erahm out with test failures
> in bug 1276366. ;)
> 
> That should fix all of these leaks.

I agree bug 1276366 is the best long term solution.  I'm just trying to plug some holes in the meantime.  Also, I want fixes that can be uplifted if possible.
(Assignee)

Comment 8

2 years ago
Created attachment 8773440 [details] [diff] [review]
P1 Avoid leaking existing windows in sdk/tab/events. r=gabor
(Assignee)

Comment 9

2 years ago
Created attachment 8773441 [details] [diff] [review]
P2 Don't leak existing windows in sdk/window/events. r=gabor

https://treeherder.mozilla.org/#/jobs?repo=try&revision=3d3393b55268
(Assignee)

Updated

2 years ago
status-firefox47: --- → wontfix
status-firefox48: --- → wontfix
status-firefox49: --- → affected
status-firefox50: --- → affected
status-firefox-esr45: --- → wontfix
(Assignee)

Comment 10

2 years ago
Comment on attachment 8773440 [details] [diff] [review]
P1 Avoid leaking existing windows in sdk/tab/events. r=gabor

This patch fixes a leak due to some of the intermediate channels being left as variables on the sandbox global.  Wrapping in a function seemed the best way to avoid the same mistake being repeated in the future.
Attachment #8773440 - Flags: review?(gkrizsanits)
(Assignee)

Comment 11

2 years ago
Comment on attachment 8773441 [details] [diff] [review]
P2 Don't leak existing windows in sdk/window/events. r=gabor

This patch is similar to P1, but for sdk/window/events instead.  Again, some of the intermediates are leaking windows.  Wrapping in a function fixes the leak.
Attachment #8773441 - Flags: review?(gkrizsanits)
(Assignee)

Comment 12

2 years ago
Comment on attachment 8773428 [details] [diff] [review]
P3 Test that sdk/tab/events does not leak. r=gabor

This test passes with the P1 patch, but fails without the P1 patch.
Attachment #8773428 - Flags: review?(gkrizsanits)
(Assignee)

Comment 13

2 years ago
Comment on attachment 8773429 [details] [diff] [review]
P4 Test that sdk/window/events does not leak existing windows. r=gabor

This test passes with the P2 patch, but fails without the P2 patch.
Attachment #8773429 - Flags: review?(gkrizsanits)
Comment on attachment 8773440 [details] [diff] [review]
P1 Avoid leaking existing windows in sdk/tab/events. r=gabor

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

This all looks great, thanks for finding/fixing these leaks!
Attachment #8773440 - Flags: review?(gkrizsanits) → review+
Attachment #8773441 - Flags: review?(gkrizsanits) → review+
Attachment #8773428 - Flags: review?(gkrizsanits) → review+
Attachment #8773429 - Flags: review?(gkrizsanits) → review+

Comment 15

2 years ago
Pushed by bkelly@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/44d3308a260e
P1 Avoid leaking existing windows in sdk/tab/events. r=gabor
https://hg.mozilla.org/integration/mozilla-inbound/rev/fb9e0b43f99b
P2 Don't leak existing windows in sdk/window/events. r=gabor
https://hg.mozilla.org/integration/mozilla-inbound/rev/e97c19b04dba
P3 Test that sdk/tab/events does not leak. r=gabor
https://hg.mozilla.org/integration/mozilla-inbound/rev/2b1ddc2f0919
P4 Test that sdk/window/events does not leak existing windows. r=gabor
(Assignee)

Comment 16

2 years ago
Comment on attachment 8773440 [details] [diff] [review]
P1 Avoid leaking existing windows in sdk/tab/events. r=gabor

Approval Request Comment
[Feature/regressing bug #]: Memory leak in addons and parts of firefox browser chrome using addon-sdk.
[User impact if declined]: Degraded performance.
[Describe test coverage new/current, TreeHerder]:  Added jetpack tests in P3 and P4.
[Risks and why]: Minimal.  No functional change.
[String/UUID change made/needed]: None.
Attachment #8773440 - Flags: approval-mozilla-aurora?
(Assignee)

Comment 17

2 years ago
Comment on attachment 8773441 [details] [diff] [review]
P2 Don't leak existing windows in sdk/window/events. r=gabor

See comment 16.
Attachment #8773441 - Flags: approval-mozilla-aurora?
(Assignee)

Comment 18

2 years ago
Comment on attachment 8773429 [details] [diff] [review]
P4 Test that sdk/window/events does not leak existing windows. r=gabor

See comment 16.
Attachment #8773429 - Flags: approval-mozilla-aurora?
(Assignee)

Comment 19

2 years ago
Comment on attachment 8773428 [details] [diff] [review]
P3 Test that sdk/tab/events does not leak. r=gabor

See comment 16.
Attachment #8773428 - Flags: approval-mozilla-aurora?

Comment 20

2 years ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/44d3308a260e
https://hg.mozilla.org/mozilla-central/rev/fb9e0b43f99b
https://hg.mozilla.org/mozilla-central/rev/e97c19b04dba
https://hg.mozilla.org/mozilla-central/rev/2b1ddc2f0919
Status: ASSIGNED → RESOLVED
Last Resolved: 2 years ago
status-firefox50: affected → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla50
Comment on attachment 8773440 [details] [diff] [review]
P1 Avoid leaking existing windows in sdk/tab/events. r=gabor

Fix a leak, taking it in aurora.
Attachment #8773440 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Attachment #8773441 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Attachment #8773429 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Attachment #8773428 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
You need to log in before you can comment on or make changes to this bug.