LinkResolve 0.3 add-on (under review) creates zombie compartments

RESOLVED FIXED

Status

Tech Evangelism
Add-ons
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: TheOne, Unassigned)

Tracking

(Blocks: 1 bug)

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [MemShrink:P3])

Attachments

(1 attachment)

156.71 KB, application/octet-stream
Details
(Reporter)

Description

5 years ago
This add-on leaks chrome compartments

1) Install the add-on (v0.3) from https://addons.mozilla.org/en-US/firefox/addon/linkresolve/
2) Disable the add-on
3) Go to about:memory?version

The author has been informed about this bug.

Could this be bug 724433?
Blocks: 668871, 700547
No longer depends on: 668871, 700547
According to the developer, these are SDK leaks and using the trunk fixes the problem. We should verify this after 1.5 is released and the add-on is updated.
Summary: LinkyResolve 0.3 add-on (under review) creates zombie compartments → LinkResolve 0.3 add-on (under review) creates zombie compartments
Whiteboard: [MemShrink] → [MemShrink:P3]
I just notified the developer about the 1.5 SDK.
Please note that according to bug 730566 comment #5, some SDK leaks are still present.
Component: General → Add-ons
Product: Core → Tech Evangelism
I just sent a message to the developer requesting them to update to the 1.6 SDK and submit an update.
version 0.7 still remains present on disable, even after repacking with SDK 1.6.
Additionally, the add-on leaks during use.
Steps to Reproduce:
1) Go to http://www.google.com/
2) select Resolve Link context menu item
3) close tab
4) go to about:memory?verbose and see reference to http://www.google.com still.
(In reply to Andrew Williamson [:eviljeff] from comment #5)
> 4) go to about:memory?verbose and see reference to http://www.google.com
> still.

I pressed minimize memory usage a few times also, btw.
> Steps to Reproduce:
> 1) Go to http://www.google.com/

In here I had to search for something, in order to bring up the page of search results.  Then I did...

> 2) select Resolve Link context menu item
> 3) close tab
> 4) go to about:memory?verbose and see reference to http://www.google.com
> still.

I got zombie compartments for the linked-to page as well.

If I did a follow-up search with Bing, and the zombie compartments for google and the previous search were replaced with the zombies from the Bing search.
The zombie compartment that appears when resolving a URL has been fixed in the latest version. There's still a zombie left when the add-on is disabled, but it might be an SDK bug.

The compartment points to preferences-service.js. What the add-on does is basically this:

> var prefs = require("simple-prefs");
> ...
> onMessage: function (ahref) {
>   ...
>   if (prefs.prefs["open_in_new_tab"]) { ... }
>   ...
> }
> ...
> exports.onUnload = function (reason) {
>   prefs = null
>   ...
> }

It sounds to me like the onMessage closure is being held even after the add-on is disabled.

Comment 9

5 years ago
(In reply to Jorge Villalobos [:jorgev] from comment #8)
> The zombie compartment that appears when resolving a URL has been fixed in
> the latest version. There's still a zombie left when the add-on is disabled,
> but it might be an SDK bug.
> 
> The compartment points to preferences-service.js. What the add-on does is
> basically this:
> 
> > var prefs = require("simple-prefs");
> > ...
> > onMessage: function (ahref) {
> >   ...
> >   if (prefs.prefs["open_in_new_tab"]) { ... }
> >   ...
> > }
> > ...
> > exports.onUnload = function (reason) {
> >   prefs = null
> >   ...
> > }
> 
> It sounds to me like the onMessage closure is being held even after the
> add-on is disabled.

I also try nulling prefs immediate after that like

> var prefs = require("simple-prefs");
> ...
> onMessage: function (ahref) {
>   ...
>   if (prefs.prefs["open_in_new_tab"]) { ... }
>   prefs = null;
> }
> ...
> exports.onUnload = function (reason) {
>   prefs = null
>   ...
> }


But it leaks too.
Alex, can you look into this? Do you think this is an SDK bug?
Depends on: 764831
(In reply to Jorge Villalobos [:jorgev] from comment #10)
> Alex, can you look into this? Do you think this is an SDK bug?

Confirmed, the SDK is leaking.
Do not hesitate to cc me when you are seing something weird around SDK addons.

I filled an SDK bug 764831. More details there.
I just landed bug 764831, it would be cool to give it a try with a repacked version of your addon against git master.
You can download it without using git:
.zip:
https://github.com/mozilla/addon-sdk/zipball/master
.tar.gz:
https://github.com/mozilla/addon-sdk/tarball/master
Thomasy, can you repack your add-on with the latest stable version of the SDK and give it a try?

Comment 14

5 years ago
(In reply to Jorge Villalobos [:jorgev] from comment #13)
> Thomasy, can you repack your add-on with the latest stable version of the
> SDK and give it a try?

I use Nightly 20120822 

> cfx run 

> Resolve url @ http://thomasy.tw/

> Disable addons

> Open about:compartments?verbose

Main Process

User Compartments

System Compartments
[System Principal]
atoms
moz-nullprincipal:{19a7c7c7-fc9a-4b65-82da-2826486d7357}

Ghost Windows

I seems that there is no leak at all.

Comment 15

5 years ago
Created attachment 654448 [details]
Repack with addons-sdk 1.9
This version leaks in Firefox 14, but not in 15, so it looks like the bug is fixed in Firefox and not the SDK (I didn't test other versions, though). I recommend that you submit this new version anyway, since there are other important fixes that went into the SDK.

Comment 17

5 years ago
Get it. Submit https://addons.mozilla.org/zh-TW/firefox/addon/linkresolve/versions/?page=1#version-0.8
The latest version is on AMO and Firefox 15 will be released next Tuesday. Calling this fixed.
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.