Closed Bug 743215 Opened 12 years ago Closed 12 years ago

"Scriptish 0.1.7" creates zombie compartments upon closing a browser window

Categories

(WebExtensions :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: Fanolian+BMO, Assigned: evold)

References

()

Details

(Whiteboard: [MemShrink:P3])

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:14.0) Gecko/20120405 Firefox/14.0a1
Build ID: 20120405105200

Steps to reproduce:

1. In a new profile, install Scriptish 0.1.7 and an userscript (I use YouTube Link Title because it activates on most sites).
    https://addons.mozilla.org/firefox/addon/scriptish/
    https://userscripts.org/scripts/show/83584
2. Open about:memory?verbose and about:compartments?verbose and check that no zombie compartments or ghost windows exist at this point.
3. Open a new browser window, go to http://www.yahoo.com. (or presumably any sites that will trigger an userscript.)
4. Close the new window. Check for zombie compartments.


Actual results:

http://www.yahoo.com/ becomes a zombie compartment and ghost window. It stays after clicking minimize memory usage for a few times.


Expected results:

The compartment should have destroyed.

Note: If I use Greasemonkey 0.9.18 instead of Scriptish 0.1.7, no zombie compartments is created. Therefore it is not the userscript's issue.
about:memory?verbose and about:compartments?verbose

Main Process

User Compartments
http://www.yahoo.com/ [2]

System Compartments
[System Principal]
atoms
moz-nullprincipal:{5f75cee5-9593-4899-b962-81a7838987b8}

Ghost Windows
http://www.yahoo.com/ [2]

-------------------------
Main Process

Explicit Allocations
42,739,423 B (100.0%) -- explicit
├──19,937,894 B (46.65%) -- js
│  ├───9,380,718 B (21.95%) -- compartment([System Principal], 0x6b80000)
│  │   ├──5,054,464 B (11.83%) -- gc-heap
│  │   │  ├──1,777,512 B (04.16%) -- shapes
│  │   │  │  ├──1,069,128 B (02.50%) ── tree
│  │   │  │  ├────401,856 B (00.94%) ── base
│  │   │  │  └────306,528 B (00.72%) ── dict
│  │   │  ├──1,691,248 B (03.96%) -- objects
│  │   │  │  ├──1,205,232 B (02.82%) ── function
│  │   │  │  └────486,016 B (01.14%) ── non-function
│  │   │  ├────785,104 B (01.84%) -- arena
│  │   │  │    ├──748,392 B (01.75%) ── unused
│  │   │  │    ├───19,744 B (00.05%) ── headers
│  │   │  │    └───16,968 B (00.04%) ── padding
│  │   │  ├────722,176 B (01.69%) ── scripts
│  │   │  ├─────49,504 B (00.12%) ── type-objects
│  │   │  ├─────28,608 B (00.07%) ── strings
│  │   │  └────────312 B (00.00%) ── xml
│  │   ├──1,820,120 B (04.26%) ── script-data
│  │   ├──1,095,616 B (02.56%) -- shapes-extra
│  │   │  ├────491,520 B (01.15%) ── compartment-tables
│  │   │  ├────363,648 B (00.85%) ── tree-tables
│  │   │  ├────120,608 B (00.28%) ── dict-tables
│  │   │  └────119,840 B (00.28%) ── tree-shape-kids
│  │   ├────790,096 B (01.85%) -- objects
│  │   │    ├──761,856 B (01.78%) ── slots
│  │   │    ├───21,424 B (00.05%) ── misc
│  │   │    └────6,816 B (00.02%) ── elements
│  │   ├────352,304 B (00.82%) -- mjit
│  │   │    ├──327,680 B (00.77%) ── code
│  │   │    └───24,624 B (00.06%) ── data
│  │   ├────131,072 B (00.31%) ── analysis-temporary
│  │   ├────106,214 B (00.25%) ── string-chars
│  │   └─────30,832 B (00.07%) -- type-inference
│  │         └──30,832 B (00.07%) ── script-main
│  ├───5,636,616 B (13.19%) -- compartment(http://www.yahoo.com/)
│  │   ├──3,350,528 B (07.84%) -- gc-heap
│  │   │  ├──1,295,808 B (03.03%) -- arena
│  │   │  │  ├──1,274,304 B (02.98%) ── unused [2]
│  │   │  │  ├─────13,088 B (00.03%) ── headers [2]
│  │   │  │  └──────8,416 B (00.02%) ── padding [2]
│  │   │  ├──1,140,912 B (02.67%) -- objects
│  │   │  │  ├────886,624 B (02.07%) ── non-function [2]
│  │   │  │  └────254,288 B (00.59%) ── function [2]
│  │   │  ├────489,440 B (01.15%) -- shapes
│  │   │  │    ├──289,656 B (00.68%) ── tree [2]
│  │   │  │    ├──151,176 B (00.35%) ── dict [2]
│  │   │  │    └───48,608 B (00.11%) ── base [2]
│  │   │  ├────246,288 B (00.58%) ── scripts [2]
│  │   │  ├────126,080 B (00.29%) ── type-objects [2]
│  │   │  └─────52,000 B (00.12%) ── strings
│  │   ├────820,704 B (01.92%) ── script-data [2]
│  │   ├────334,864 B (00.78%) -- objects
│  │   │    ├──330,432 B (00.77%) ── slots [2]
│  │   │    ├────3,840 B (00.01%) ── elements [2]
│  │   │    └──────592 B (00.00%) ── misc [2]
│  │   ├────327,680 B (00.77%) -- mjit
│  │   │    └──327,680 B (00.77%) ── code
│  │   ├────318,880 B (00.75%) -- shapes-extra
│  │   │    ├──184,160 B (00.43%) ── tree-tables [2]
│  │   │    ├───62,176 B (00.15%) ── dict-tables [2]
│  │   │    ├───51,296 B (00.12%) ── tree-shape-kids [2]
│  │   │    └───21,248 B (00.05%) ── compartment-tables [2]
│  │   ├────243,648 B (00.57%) ── analysis-temporary [2]
│  │   ├────216,856 B (00.51%) -- type-inference
│  │   │    ├──149,568 B (00.35%) ── object-main [2]
│  │   │    └───67,288 B (00.16%) ── tables [2]
│  │   └─────23,456 B (00.05%) ── string-chars
│  ├───1,711,744 B (04.01%) -- compartment(atoms)
│  │   ├──1,035,904 B (02.42%) ── string-chars
│  │   └────675,840 B (01.58%) -- gc-heap
│  │        ├──660,288 B (01.54%) ── strings
│  │        └───15,552 B (00.04%) -- arena
│  │            ├──11,664 B (00.03%) ── unused
│  │            ├───2,640 B (00.01%) ── headers
│  │            └───1,248 B (00.00%) ── padding
│  ├───1,208,320 B (02.83%) ── gc-heap-decommitted
│  ├───1,186,624 B (02.78%) -- runtime
│  │   ├────524,288 B (01.23%) ── atoms-table
│  │   ├────262,144 B (00.61%) ── regexp-code
│  │   ├────131,072 B (00.31%) ── stack-committed
│  │   ├────131,072 B (00.31%) ── gc-marker
│  │   ├────106,496 B (00.25%) ── runtime-object
│  │   ├─────23,360 B (00.05%) ── contexts
│  │   ├──────4,096 B (00.01%) ── normal
│  │   └──────4,096 B (00.01%) ── temporary
│  ├─────614,472 B (01.44%) ── xpconnect
│  ├─────163,840 B (00.38%) ── gc-heap-chunk-admin
│  ├──────35,560 B (00.08%) -- compartment(moz-nullprincipal:{5f75cee5-9593-4899-b962-81a7838987b8})
│  │      ├──32,768 B (00.08%) -- gc-heap
│  │      │  ├──29,176 B (00.07%) -- arena
│  │      │  │  ├──28,888 B (00.07%) ── unused
│  │      │  │  ├─────160 B (00.00%) ── padding
│  │      │  │  └─────128 B (00.00%) ── headers
│  │      │  ├───1,848 B (00.00%) -- shapes
│  │      │  │   ├────984 B (00.00%) ── tree
│  │      │  │   ├────480 B (00.00%) ── base
│  │      │  │   └────384 B (00.00%) ── dict
│  │      │  ├───1,504 B (00.00%) -- objects
│  │      │  │   ├──1,248 B (00.00%) ── function
│  │      │  │   └────256 B (00.00%) ── non-function
│  │      │  ├─────128 B (00.00%) ── type-objects
│  │      │  └─────112 B (00.00%) ── scripts
│  │      ├───1,664 B (00.00%) -- objects
│  │      │   ├──1,536 B (00.00%) ── slots
│  │      │   └────128 B (00.00%) ── misc
│  │      ├───1,120 B (00.00%) -- shapes-extra
│  │      │   ├────896 B (00.00%) ── compartment-tables
│  │      │   ├────160 B (00.00%) ── dict-tables
│  │      │   └─────64 B (00.00%) ── tree-shape-kids
│  │      └───────8 B (00.00%) ── script-data
│  ├───────────0 B (00.00%) ── gc-heap-chunk-dirty-unused
│  └───────────0 B (00.00%) ── gc-heap-chunk-clean-unused
├──10,100,924 B (23.63%) ── heap-unclassified
├───5,049,808 B (11.82%) -- storage
│   ├──5,049,648 B (11.81%) -- sqlite
│   │  ├──1,797,352 B (04.21%) -- places.sqlite
│   │  │  ├──1,583,672 B (03.71%) ── cache-used [4]
│   │  │  ├────157,712 B (00.37%) ── stmt-used [4]
│   │  │  └─────55,968 B (00.13%) ── schema-used [4]
│   │  ├──1,314,380 B (03.08%) ── other
│   │  ├────507,116 B (01.19%) -- extensions.sqlite
│   │  │    ├──329,964 B (00.77%) ── cache-used
│   │  │    ├──169,360 B (00.40%) ── stmt-used
│   │  │    └────7,792 B (00.02%) ── schema-used
│   │  ├────296,140 B (00.69%) -- addons.sqlite
│   │  │    ├──264,148 B (00.62%) ── cache-used
│   │  │    ├───25,792 B (00.06%) ── stmt-used
│   │  │    └────6,200 B (00.01%) ── schema-used
│   │  ├────283,640 B (00.66%) -- chromeappsstore.sqlite
│   │  │    ├──264,424 B (00.62%) ── cache-used
│   │  │    ├───14,848 B (00.03%) ── stmt-used
│   │  │    └────4,368 B (00.01%) ── schema-used
│   │  ├────202,944 B (00.47%) -- webappsstore.sqlite
│   │  │    ├──198,608 B (00.46%) ── cache-used
│   │  │    ├────4,336 B (00.01%) ── schema-used
│   │  │    └────────0 B (00.00%) ── stmt-used
│   │  ├────179,816 B (00.42%) -- cookies.sqlite
│   │  │    ├──165,424 B (00.39%) ── cache-used
│   │  │    ├───12,512 B (00.03%) ── stmt-used
│   │  │    └────1,880 B (00.00%) ── schema-used
│   │  ├────144,996 B (00.34%) -- content-prefs.sqlite
│   │  │    ├──132,516 B (00.31%) ── cache-used
│   │  │    ├────9,984 B (00.02%) ── stmt-used
│   │  │    └────2,496 B (00.01%) ── schema-used
│   │  ├────109,008 B (00.26%) -- downloads.sqlite
│   │  │    ├───99,608 B (00.23%) ── cache-used
│   │  │    ├────7,568 B (00.02%) ── stmt-used
│   │  │    └────1,832 B (00.00%) ── schema-used
│   │  ├────107,432 B (00.25%) -- permissions.sqlite
│   │  │    ├───99,608 B (00.23%) ── cache-used
│   │  │    ├────6,528 B (00.02%) ── stmt-used
│   │  │    └────1,296 B (00.00%) ── schema-used
│   │  └────106,824 B (00.25%) -- signons.sqlite
│   │       ├───99,608 B (00.23%) ── cache-used
│   │       ├────3,872 B (00.01%) ── stmt-used
│   │       └────3,344 B (00.01%) ── schema-used
│   └────────160 B (00.00%) -- prefixset
│            ├───80 B (00.00%) ── test-malware-simple
│            └───80 B (00.00%) ── test-phish-simple
├───2,963,960 B (06.93%) -- images
│   ├──2,634,828 B (06.16%) -- content
│   │  ├──2,634,828 B (06.16%) -- used
│   │  │  ├──2,231,420 B (05.22%) ── uncompressed-heap
│   │  │  ├────403,408 B (00.94%) ── raw
│   │  │  └──────────0 B (00.00%) ── uncompressed-nonheap
│   │  └──────────0 B (00.00%) -- unused
│   │             ├──0 B (00.00%) ── raw
│   │             ├──0 B (00.00%) ── uncompressed-heap
│   │             └──0 B (00.00%) ── uncompressed-nonheap
│   └────329,132 B (00.77%) -- chrome
│        ├──329,132 B (00.77%) -- used
│        │  ├──329,132 B (00.77%) ── uncompressed-heap
│        │  ├────────0 B (00.00%) ── raw
│        │  └────────0 B (00.00%) ── uncompressed-nonheap
│        └────────0 B (00.00%) -- unused
│                 ├──0 B (00.00%) ── raw
│                 ├──0 B (00.00%) ── uncompressed-heap
│                 └──0 B (00.00%) ── uncompressed-nonheap
├───2,116,296 B (04.95%) -- window-objects
│   ├──1,309,456 B (03.06%) -- top(chrome://browser/content/browser.xul, id=1)
│   │  └──1,309,456 B (03.06%) -- active
│   │     ├──1,304,336 B (03.05%) -- window(chrome://browser/content/browser.xul)
│   │     │  ├────755,184 B (01.77%) -- layout
│   │     │  │    ├──442,128 B (01.03%) ── arenas
│   │     │  │    └──313,056 B (00.73%) ── style-sets
│   │     │  ├────375,616 B (00.88%) ── style-sheets
│   │     │  └────173,536 B (00.41%) ── dom [2]
│   │     └──────5,120 B (00.01%) -- window(about:blank)
│   │            └──5,120 B (00.01%) ── dom [4]
│   ├────503,360 B (01.18%) -- top(about:memory?verbose, id=7)
│   │    └──503,360 B (01.18%) -- active
│   │       └──503,360 B (01.18%) -- window(about:memory?verbose)
│   │          ├──486,224 B (01.14%) -- layout
│   │          │  ├──388,880 B (00.91%) ── arenas
│   │          │  └───97,344 B (00.23%) ── style-sets
│   │          ├────9,664 B (00.02%) ── style-sheets
│   │          └────7,472 B (00.02%) ── dom [2]
│   ├────165,512 B (00.39%) -- top(about:compartments, id=12)
│   │    └──165,512 B (00.39%) -- active
│   │       └──165,512 B (00.39%) -- window(about:compartments)
│   │          ├──145,232 B (00.34%) -- layout
│   │          │  ├───97,344 B (00.23%) ── style-sets
│   │          │  └───47,888 B (00.11%) ── arenas
│   │          ├───10,616 B (00.02%) ── dom [2]
│   │          └────9,664 B (00.02%) ── style-sheets
│   ├────136,144 B (00.32%) -- top(resource://gre-resources/hiddenWindow.html, id=3)
│   │    └──136,144 B (00.32%) -- active
│   │       └──136,144 B (00.32%) -- window(resource://gre-resources/hiddenWindow.html)
│   │          ├──133,360 B (00.31%) -- layout
│   │          │  ├───95,712 B (00.22%) ── style-sets
│   │          │  └───37,648 B (00.09%) ── arenas
│   │          └────2,784 B (00.01%) ── dom [2]
│   └──────1,824 B (00.00%) -- top(none)
│          ├────928 B (00.00%) -- detached
│          │    └──928 B (00.00%) -- window([system])
│          │       └──928 B (00.00%) ── dom [2]
│          └────896 B (00.00%) -- ghost
│               └──896 B (00.00%) -- window(http://www.yahoo.com/)
│                  └──896 B (00.00%) ── dom [2]
├─────966,688 B (02.26%) ── xpti-working-set
├─────767,373 B (01.80%) -- startup-cache
│     ├──766,973 B (01.79%) ── mapping
│     └──────400 B (00.00%) ── data
├─────423,888 B (00.99%) ── atom-table
├─────216,472 B (00.51%) -- layout
│     └──216,472 B (00.51%) ── style-sheet-cache
├─────153,232 B (00.36%) -- gfx
│     ├───84,960 B (00.20%) ── font-charmaps
│     ├───63,808 B (00.15%) ── font-list
│     ├────4,336 B (00.01%) ── font-cache
│     └──────128 B (00.00%) ── font-shaped-words
├──────26,744 B (00.06%) ── cycle-collector
├──────16,144 B (00.04%) ── history-links-hashtable
└───────────0 B (00.00%) ── spell-check

Other Measurements
          0 B ── canvas-2d-pixel-bytes
 42,741,555 B ── explicit
  1,675,532 B ── gfx-d2d-surfacecache
  8,080,892 B ── gfx-d2d-surfacevram
  2,574,188 B ── gfx-surface-image
            2 ── ghost-windows
 30,438,114 B ── heap-allocated
 38,109,184 B ── heap-committed
       20.10% ── heap-committed-fragmentation
  3,608,576 B ── heap-dirty
 26,183,804 B ── heap-unallocated
  2,231,420 B ── images-content-used-uncompressed
            2 ── js-compartments-system
            3 ── js-compartments-user
 10,485,760 B ── js-gc-heap
    374,720 B ── js-main-runtime-analysis-temporary
  2,063,248 B ── js-main-runtime-gc-heap-arena-unused
          0 B ── js-main-runtime-gc-heap-chunk-clean-unused
          0 B ── js-main-runtime-gc-heap-chunk-dirty-unused
  1,208,320 B ── js-main-runtime-gc-heap-decommitted
        2.52% ── js-main-runtime-gc-heap-unused-fraction
    679,984 B ── js-main-runtime-mjit
  3,960,288 B ── js-main-runtime-objects
  3,609,408 B ── js-main-runtime-scripts
  3,513,216 B ── js-main-runtime-shapes
  1,906,470 B ── js-main-runtime-strings
    423,400 B ── js-main-runtime-type-inference
            0 ── low-commit-space-events
            0 ── low-memory-events-physical
            0 ── low-memory-events-virtual
102,313,984 B ── private
131,379,200 B ── resident
  5,049,648 B ── storage-sqlite
508,407,808 B ── vsize
    201,352 B ── window-objects-dom
    916,544 B ── window-objects-layout-arenas
    603,456 B ── window-objects-layout-style-sets
          0 B ── window-objects-layout-text-runs
    394,944 B ── window-objects-style-sheets
Whiteboard: [MemShrink]
Jorge, can you please contact the authors?
Bug 707403 was also about Scriptish, interestingly enough.
P3 per Memshrink
Whiteboard: [MemShrink] → [MemShrink:P3]
developer contacted via AMO.
Erik or Nils, can you verify that this leak happens? If it does, when can we expect a fixed version?
I haven't verified this yet.

I'm working on converting Scriptish to use the add-on sdk though when I have time, so I'm not sure when I'll have a chance to look at this.
I can confirm the leak using the steps in comment #0. Note that it is necessary to open a new window for this to happen. I can't reproduce the problem if I open a new tab. Also, I can confirm the leak doesn't happen if there are no usercripts installed.

I didn't verify that GM doesn't leak.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Erik, what's the status of this bug and bug 743414? Have you verified them? Is this something that is fixed in Firefox 15?
I just tested with an FF18 trunk build and it still leaks following the steps in comment 0 with Jorge's "new window" modification in comment 8.  So FF15 didn't fix this one.  Interesting.

Nils, do you have time to investigate?  AMO policy is that we should have downgraded this to preliminary review months ago.
(In reply to Nicholas Nethercote [:njn] from comment #10)
> I just tested with an FF18 trunk build and it still leaks following the
> steps in comment 0 with Jorge's "new window" modification in comment 8.  So
> FF15 didn't fix this one.  Interesting.

I didn't yet try to reproduce this. Anybody tested if Scriptish Nightly is affected? I do now that the current Aurora/Nightly do not work correctly with Scriptish Release due to __exposedProps__.
https://github.com/scriptish/scriptish-nightlies/downloads

(In reply to Nicholas Nethercote [:njn] from comment #10)
> Nils, do you have time to investigate?  AMO policy is that we should have
> downgraded this to preliminary review months ago.

I'm actually just a casual contributor. And I wanted to spend my available time getting my MinTrayR add-on into shape right now...
Anyway, if Greg or Erik aren't available?, I might have some hours to spare in the next few days to investigate this.
I've confirmed this on FF14 w/ HEAD of Scriptish with a simple script that does nothing more than register a menu item.  If the user script does not use a menu item then the problem does not occur.  I'll see if I can track down the cause..
Assignee: nobody → evold
Status: NEW → ASSIGNED
I think this is resolved by https://github.com/scriptish/scriptish/commit/d4da9ada05633517c97d4515ea1453e69531fa3e

Can someone try the Scriptish nightly tomorrow to confirm?
http://scriptish.org/downloads/
(In reply to Erik Vold [:erikvold] from comment #13)
> I think this is resolved by
> https://github.com/scriptish/scriptish/commit/
> d4da9ada05633517c97d4515ea1453e69531fa3e
> 
> Can someone try the Scriptish nightly tomorrow to confirm?
> http://scriptish.org/downloads/

I can confirm that no zombie compartment after following Comment 1 steps to reproduce with Scriptish
Erik, has this fixed version been released on AMO?
(In reply to Jorge Villalobos [:jorgev] from comment #15)
> Erik, has this fixed version been released on AMO?

I'll do it by Sunday at the latest.
The fixed version was released on AMO.
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Component: Add-ons → General
Product: Tech Evangelism → WebExtensions
You need to log in before you can comment on or make changes to this bug.