Closed Bug 759581 Opened 12 years ago Closed 4 years ago

Multiple, persistent "[System Principal], about:blank" compartments

Categories

(Firefox :: General, defect)

defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: bj, Unassigned)

References

Details

(Whiteboard: [MemShrink:P2])

This issue was pointed out in MozillaZine (<http://forums.mozillazine.org/viewtopic.php?f=23&t=2479823&sid=12640f234441b943b3136e702baeb491&p=12021005#p12021005>). Someone reported:
====================================================================================
Does anyone have an about:blank entry in about:memory which doesn't seem to go away?

├────4.87 MB (03.02%) -- compartment([System Principal], about:blank)
│ │ ├──2.87 MB (01.78%) -- (9 tiny)
│ │ │ ├──1.23 MB (00.77%) ++ gc-heap
│ │ │ ├──0.85 MB (00.53%) ── script-data
│ │ │ ├──0.34 MB (00.21%) ── string-chars
│ │ │ ├──0.19 MB (00.12%) ++ shapes-extra
│ │ │ ├──0.12 MB (00.08%) ── mjit-data
│ │ │ ├──0.07 MB (00.04%) ── objects/slots
│ │ │ ├──0.02 MB (00.01%) ── cross-compartment-wrappers
│ │ │ ├──0.02 MB (00.01%) ── other-sundries [4]
│ │ │ └──0.01 MB (00.01%) ── type-inference/script-main
│ │ └──2.00 MB (01.24%) ── analysis-temporary
====================================================================================

Looking at my current memory use I have about:blank using over 30MB (details below). I currently have seven tabs opened in two windows, with none of the tabs being blank. I noticed this with my session, then updated to the latest Nightly and the restarted Firefox was still using memory for about:blank.

Memory information *after* pressing the "Minimize memory usage" button:

Main Process

Explicit Allocations
231.25 MB (100.0%) -- explicit
├──152.03 MB (65.74%) -- js
│  ├───32.75 MB (14.16%) ++ (229 tiny)
│  ├───31.50 MB (13.62%) -- compartment([System Principal], about:blank)
│  │   ├──18.45 MB (07.98%) -- gc-heap
│  │   │  ├───5.80 MB (02.51%) -- arena
│  │   │  │   ├──5.47 MB (02.36%) ── unused [18]
│  │   │  │   └──0.33 MB (00.14%) ++ (2 tiny)
│  │   │  ├───5.47 MB (02.36%) -- objects
│  │   │  │   ├──2.79 MB (01.21%) ── function [9]
│  │   │  │   └──2.68 MB (01.16%) ── non-function [6]
│  │   │  ├───4.21 MB (01.82%) -- shapes
│  │   │  │   ├──3.01 MB (01.30%) ── tree [15]
│  │   │  │   └──1.21 MB (00.52%) ++ (2 tiny)
│  │   │  ├───2.63 MB (01.14%) ── scripts [6]
│  │   │  └───0.33 MB (00.14%) ++ (3 tiny)
│  │   ├───8.04 MB (03.48%) ── script-data [6]
│  │   ├───3.25 MB (01.41%) ++ shapes-extra
│  │   └───1.76 MB (00.76%) ++ (6 tiny)
│  ├───22.45 MB (09.71%) ── gc-heap-decommitted
│  ├───19.63 MB (08.49%) -- compartment([System Principal], file:///home/bj/.mozilla/firefox/5p1nzf4y.Ubuntu%20Nightly/extensions/https-everywhere@eff.org/components/https-everywhere.js)
│  │   ├──19.19 MB (08.30%) -- gc-heap
│  │   │  ├──11.04 MB (04.78%) -- arena
│  │   │  │  ├──10.67 MB (04.61%) ── unused
│  │   │  │  └───0.38 MB (00.16%) ++ (2 tiny)
│  │   │  ├───3.98 MB (01.72%) ── xml
│  │   │  ├───3.70 MB (01.60%) -- objects
│  │   │  │   ├──3.66 MB (01.58%) ── non-function
│  │   │  │   └──0.04 MB (00.02%) ── function
│  │   │  └───0.46 MB (00.20%) ++ (4 tiny)
│  │   └───0.44 MB (00.19%) ++ (5 tiny)
│  ├───14.05 MB (06.08%) -- compartment([System Principal], chrome://adblockplus-modules/content/FilterClasses.jsm)
│  │   ├──11.33 MB (04.90%) -- gc-heap
│  │   │  ├───5.10 MB (02.21%) -- arena
│  │   │  │   ├──4.94 MB (02.14%) ── unused
│  │   │  │   └──0.16 MB (00.07%) ++ (2 tiny)
│  │   │  ├───3.33 MB (01.44%) -- objects
│  │   │  │   ├──3.32 MB (01.43%) ── non-function
│  │   │  │   └──0.02 MB (00.01%) ── function
│  │   │  └───2.90 MB (01.25%) ++ (3 tiny)
│  │   └───2.72 MB (01.18%) ++ (6 tiny)
│  ├────9.46 MB (04.09%) -- runtime
│  │    ├──4.00 MB (01.73%) ── atoms-table
│  │    ├──4.00 MB (01.73%) ── stack-committed
│  │    └──1.46 MB (00.63%) ++ (11 tiny)
│  ├────8.48 MB (03.67%) -- compartment(atoms)
│  │    ├──6.12 MB (02.65%) -- gc-heap
│  │    │  ├──5.42 MB (02.34%) ── strings
│  │    │  └──0.70 MB (00.30%) ++ arena
│  │    ├──2.36 MB (01.02%) ── string-chars
│  │    └──0.00 MB (00.00%) ── other-sundries
│  ├────3.34 MB (01.44%) ++ compartment([System Principal], chrome://adblockplus-modules/content/FilterListener.jsm)
│  ├────3.05 MB (01.32%) ++ compartment(https://bugzilla.mozilla.org/show_bug.cgi?id=713203)
│  ├────2.55 MB (01.10%) ++ compartment([System Principal])
│  ├────2.39 MB (01.03%) ++ compartment([System Principal], chrome://adblockplus-modules/content/SubscriptionClasses.jsm)
│  └────2.37 MB (01.03%) ── xpconnect
├───32.92 MB (14.24%) -- window-objects
│   ├──10.35 MB (04.48%) -- top(about:memory?verbose, id=28)/active/window(about:memory?verbose)
│   │  ├───6.79 MB (02.94%) ── dom [2]
│   │  ├───3.55 MB (01.53%) -- layout
│   │  │   ├──3.40 MB (01.47%) ── arenas
│   │  │   └──0.15 MB (00.07%) ++ (2 tiny)
│   │  └───0.02 MB (00.01%) ── style-sheets
│   ├───5.91 MB (02.56%) ++ (13 tiny)
│   ├───4.40 MB (01.90%) -- top(https://bugzilla.mozilla.org/show_bug.cgi?id=713203, id=75)/active
│   │   ├──4.21 MB (01.82%) -- window(https://bugzilla.mozilla.org/show_bug.cgi?id=713203)
│   │   │  ├──2.82 MB (01.22%) ++ layout
│   │   │  └──1.39 MB (00.60%) ++ (2 tiny)
│   │   └──0.19 MB (00.08%) ++ window(about:blank)
│   ├───4.31 MB (01.86%) ++ top(chrome://browser/content/browser.xul, id=1)/active
│   ├───3.98 MB (01.72%) ++ top(chrome://browser/content/browser.xul, id=24)/active
│   └───3.97 MB (01.72%) ++ top(chrome://browser/content/browser.xul, id=26)/active
├───29.13 MB (12.60%) ── heap-unclassified
├────9.28 MB (04.01%) -- storage
│    ├──7.92 MB (03.42%) ++ sqlite
│    └──1.36 MB (00.59%) ── prefixset/all
├────4.27 MB (01.85%) -- startup-cache
│    ├──4.27 MB (01.85%) ── data
│    └──0.00 MB (00.00%) ── mapping
└────3.61 MB (01.56%) ++ (7 tiny)

Other Measurements
    0.00 MB ── canvas-2d-pixel-bytes
  231.25 MB ── explicit
    0.06 MB ── gfx-surface-image
    0.18 MB ── gfx-surface-xlib
          0 ── ghost-windows
  118.93 MB ── heap-allocated
  142.35 MB ── heap-committed
   23.40 MB ── heap-committed-unused
     19.67% ── heap-committed-unused-ratio
    3.34 MB ── heap-dirty
  132.06 MB ── heap-unused
    0.00 MB ── images-content-used-uncompressed
        281 ── js-compartments-system
          8 ── js-compartments-user
  108.00 MB ── js-gc-heap
    0.65 MB ── js-main-runtime-analysis-temporary
   51.10 MB ── js-main-runtime-gc-heap-allocated
   34.45 MB ── js-main-runtime-gc-heap-arena-unused
    0.00 MB ── js-main-runtime-gc-heap-chunk-clean-unused
    0.00 MB ── js-main-runtime-gc-heap-chunk-dirty-unused
   85.55 MB ── js-main-runtime-gc-heap-committed
   34.45 MB ── js-main-runtime-gc-heap-committed-unused
     67.42% ── js-main-runtime-gc-heap-committed-unused-ratio
   22.45 MB ── js-main-runtime-gc-heap-decommitted
    0.31 MB ── js-main-runtime-mjit
   23.56 MB ── js-main-runtime-objects
   16.08 MB ── js-main-runtime-scripts
   17.87 MB ── js-main-runtime-shapes
   14.23 MB ── js-main-runtime-strings
    0.67 MB ── js-main-runtime-type-inference
        158 ── page-faults-hard
    871,841 ── page-faults-soft
  262.03 MB ── resident
    7.92 MB ── storage-sqlite
1,079.44 MB ── vsize
    9.81 MB ── window-objects-dom
    7.07 MB ── window-objects-layout-arenas
    0.13 MB ── window-objects-layout-pres-contexts
    8.36 MB ── window-objects-layout-style-sets
    0.00 MB ── window-objects-layout-text-runs
    7.55 MB ── window-objects-style-sheets
Whiteboard: [MemShrink]
Hi there,

Mines doing the same thing:

│  ├────7.38 MB (03.81%) -- compartment([System Principal], about:blank)
│  │    ├──3.60 MB (01.86%) -- gc-heap
│  │    │  ├──0.98 MB (00.51%) ── arena/unused [9]
│  │    │  ├──0.90 MB (00.46%) ++ objects
│  │    │  ├──0.89 MB (00.46%) ++ shapes
│  │    │  ├──0.70 MB (00.36%) ── scripts [3]
│  │    │  ├──0.10 MB (00.05%) ── sundries [9]
│  │    │  ├──0.03 MB (00.02%) ── strings
│  │    │  └──0.01 MB (00.00%) ── type-objects
│  │    ├──2.27 MB (01.17%) ── script-data [3]
│  │    └──1.51 MB (00.78%) -- (8 tiny)
│  │       ├──0.63 MB (00.32%) ── analysis-temporary
│  │       ├──0.46 MB (00.24%) ++ shapes-extra
│  │       ├──0.19 MB (00.10%) ── objects/slots [3]
│  │       ├──0.12 MB (00.06%) ── mjit-data
│  │       ├──0.06 MB (00.03%) ── other-sundries [9]
│  │       ├──0.03 MB (00.02%) ── cross-compartment-wrappers [3]
│  │       ├──0.02 MB (00.01%) ── string-chars
│  │       └──0.01 MB (00.01%) ── type-inference/script-main
Just tried it without ABP, still can reproduce (I'm on windows so perhaps change the bug to all).

Side note, without ABP FF uses around 70mb RAM, with it enabled it goes to around about 250mb on fresh start, that's related to another bug though.
I think this is intentional information by Bug 754771
(In reply to Alice0775 White from comment #3)
> I think this is intentional information by Bug 754771

I'm not sure what you're referring to.

Wow, it looks like we may be keeping an about:blank compartment alive for each session-restored tab (even after we do the lazy-load of the SR'ed tab).  Here's most of my about:compartments:

https://bugzilla.mozilla.org/process_bug.cgi
https://bugzilla.mozilla.org/process_bug.cgi, about:blank
https://bugzilla.mozilla.org/show_bug.cgi?id=742944
https://bugzilla.mozilla.org/show_bug.cgi?id=742944, about:blank
https://bugzilla.mozilla.org/show_bug.cgi?id=759581
https://bugzilla.mozilla.org/show_bug.cgi?id=759581, about:blank
https://mail.google.com/mail/u/0/?ui=2&shva=1#label/Bug!/1379ebb9ebd60c74
https://mail.google.com/mail/u/0/?ui=2&shva=1#label/Bug!/1379ebb9ebd60c74, about:blank [2]
https://mail.google.com/mail/u/0/?[...] [3]
https://mail.google.com/mail/u/0/?[...], about:blank [2]
https://www.google.com/calendar/render?pli=1
https://www.google.com/calendar/render?pli=1, about:blank
Summary: about:blank consuming 30+MB with no blank tabs → about:blank compartments from lazy session restore are never released (?)
I see about:blank compartments for one, but not all of my session restored tabs.  This is on OSX.  Bugzilla tabs but not mxr tabs seem to show up.  Closing a tab gets rid of both compartments.
OS: Linux → All
Hardware: x86_64 → All
I don't use session restore at all and it still does this, perhaps its something else?
> Does anyone have an about:blank entry in about:memory which doesn't seem to
> go away?
> 
> ├────4.87 MB (03.02%) -- compartment([System Principal], about:blank)

I've been seeing this for a while.  My feeling is that it's related to add-ons, but I haven't investigated carefully.


> Wow, it looks like we may be keeping an about:blank compartment alive for
> each session-restored tab (even after we do the lazy-load of the SR'ed tab).
> Here's most of my about:compartments:
> 
> https://bugzilla.mozilla.org/process_bug.cgi
> https://bugzilla.mozilla.org/process_bug.cgi, about:blank

I just started seeing that today, but bug 754771 landed a few days ago, so I suspect it's a new regression.  It has something to do with logging into sites AFAICT;  I've filed bug 759966 for it.  Let's keep this bug about the multiple, persistent "[System Principal], about:blank" compartments, please.
Summary: about:blank compartments from lazy session restore are never released (?) → Multiple, persistent "[System Principal], about:blank" compartments
No longer blocks: 759966
> My feeling is that it's related to
> add-ons, but I haven't investigated carefully.

That feeling appears to be false.  I just tried various configurations -- old profiles, young profiles, completely new profiles, some with add-ons, some without, even in safe mode.  Every time at start-up (with a single about:compartments tab open) I got this as the first two entries under "System compartments" in about:compartments:

  [System Principal]
  [System Principal], about:blank [3]

But my normal-use browser, which is a build from a few days ago, has this after about 8 hours of use:

  [System Principal] [7]
  [System Principal], about:blank [9]

That's again after closing all tabs except about:compartments.  So it definitely feels like a slow leak of some kind.
I observe these behavior in nightly, too. And these about:blank occupy a great amount of memory. After hours of use, regular browsing and gmail, I tried sign out gmail and close all tabs, the memory usage can't go back to a level that's comparable to startup, and these about:blank things play a big part in it. And the number indicate instances of them(about:blank [N]) always increase.
I noticed that when running Chatzilla it grew very fast.... perhaps it is addons? or XUL?
Whiteboard: [MemShrink] → [MemShrink:P1]
Reference: bug 763868 comment 12 (or see complete bug report for more details)
User Agent: Mozilla/5.0 (Windows NT 5.1; rv:16.0) Gecko/16.0 Firefox/16.0a1
Build ID: 20120612030527

Looks like I have the same problem.
Fresh Firefox has ~600 MB RAM usage. After a few hours of surfing it grows to >1 GB.

Following tabs are really opened (among others)
about:addons (once)
about:memory (once)
about:memory?verbose (once)
about:compartments?verbose (once)

Output of about:compartments
 User Compartments
  about:blank [3]
  (...)

 System Compartments
  [System Principal], about:addons [2]
  [System Principal], about:blank [101]
  [System Principal], about:compartments [3]
  [System Principal], about:compartments?verbose [2]
  [System Principal], about:memory
  [System Principal], about:memory?verbose
  (...)

 Ghost Windows
  (none)

Output of about:memory
1,163,143,174 B (100.0%) -- explicit
├────713,562,368 B (61.35%) -- js
│    ├──404,908,232 B (34.81%) -- compartment([System Principal], about:blank)
│    │  ├──221,560,832 B (19.05%) -- gc-heap
│    │  │  ├───71,426,640 B (06.14%) -- arena
│    │  │  │   ├──70,276,544 B (06.04%) ── unused [101]
│    │  │  │   ├─────645,920 B (00.06%) ── headers [49]
│    │  │  │   └─────504,176 B (00.04%) ── padding [49]
│    │  │  ├───67,769,088 B (05.83%) -- objects
│    │  │  │   ├──43,254,768 B (03.72%) ── non-function [98]
│    │  │  │   └──24,514,320 B (02.11%) ── function [99]
│    │  │  ├───41,081,312 B (03.53%) -- shapes
│    │  │  │   ├──30,410,904 B (02.61%) ── tree [99]
│    │  │  │   ├───5,666,184 B (00.49%) ── dict [98]
│    │  │  │   └───5,004,224 B (00.43%) ── base [98]
│    │  │  ├───33,363,744 B (02.87%) ── scripts [98]
│    │  │  ├────7,004,096 B (00.60%) ── strings [49]
│    │  │  ├──────863,088 B (00.07%) ── sundries [99]
│    │  │  └───────52,864 B (00.00%) ── type-objects [2]
│    │  ├──120,190,832 B (10.33%) ── script-data [98]
│    │  ├───29,459,168 B (02.53%) -- shapes-extra
│    │  │   ├──17,554,880 B (01.51%) ── tree-tables [98]
│    │  │   ├───5,868,576 B (00.50%) ── tree-shape-kids [97]
│    │  │   ├───3,962,880 B (00.34%) ── compartment-tables [98]
│    │  │   └───2,072,832 B (00.18%) ── dict-tables [96]
│    │  ├───24,544,240 B (02.11%) -- objects
│    │  │   ├──20,156,416 B (01.73%) ── slots [99]
│    │  │   └───4,387,824 B (00.38%) ── elements [49]
│    │  ├────5,093,680 B (00.44%) ── string-chars [50]
│    │  ├────1,572,864 B (00.14%) ── analysis-temporary [3]
│    │  ├──────945,184 B (00.08%) ── type-inference/script-main [96]
│    │  ├──────909,312 B (00.08%) ── cross-compartment-wrappers [67]
│    │  ├──────426,024 B (00.04%) ── other-sundries [101]
│    │  └──────206,096 B (00.02%) ── mjit-data [2]
If I get bug 753614 landed, maybe we can just look at a dump to try to figure out what is going on in that compartment.  It probably won't be helpful but you never know.
Depends on: 753614
Is there any chance to get the DOM of the about:blank compartments or so? Maybe looking whats in there helps figuring out where they come from.

Any piece of JS code to execute in the error console or so would be really great.
This is an example of one which grows with session size(669.63 MB (100.0%))


│  ├───18.06 MB (02.70%) -- compartment([System Principal], about:blank)
│  │   ├──12.28 MB (01.83%) -- gc-heap
│  │   │  ├───7.81 MB (01.17%) -- arena
│  │   │  │   ├──7.75 MB (01.16%) ── unused [4]
│  │   │  │   └──0.05 MB (00.01%) -- (2 tiny)
│  │   │  │      ├──0.04 MB (00.01%) ── headers
│  │   │  │      └──0.02 MB (00.00%) ── padding
│  │   │  └───4.48 MB (00.67%) -- (6 tiny)
│  │   │      ├──1.94 MB (00.29%) ++ objects
│  │   │      ├──1.49 MB (00.22%) ++ shapes
│  │   │      ├──0.63 MB (00.09%) ── scripts [3]
│  │   │      ├──0.32 MB (00.05%) ── strings [2]
│  │   │      ├──0.05 MB (00.01%) ── type-objects [2]
│  │   │      └──0.04 MB (00.01%) ── sundries [3]
│  │   └───5.77 MB (00.86%) -- (8 tiny)
│  │       ├──2.10 MB (00.31%) ── script-data [3]
│  │       ├──1.07 MB (00.16%) ++ shapes-extra
│  │       ├──1.01 MB (00.15%) ++ objects
│  │       ├──0.82 MB (00.12%) ── string-chars [2]
│  │       ├──0.63 MB (00.09%) ── analysis-temporary [2]
│  │       ├──0.09 MB (00.01%) ── cross-compartment-wrappers [3]
│  │       ├──0.03 MB (00.00%) ── type-inference/script-main [2]
│  │       └──0.02 MB (00.00%) ── other-sundries [4]

Sorry karl155, it just seems to grow related to total RAM used.
I have 1 about:blank compartment for every session restored not loaded tab.

about:blank [234]

Every one of them is 0.33MB and they look like this:

│  │  ├────0.33 MB (00.04%) -- top(about:blank, id=400)/active/window(about:blank)
│  │  │    ├──0.21 MB (00.03%) -- js/compartment(about:blank)
│  │  │    │  ├──0.12 MB (00.02%) ── analysis-temporary
│  │  │    │  ├──0.07 MB (00.01%) ++ gc-heap
│  │  │    │  └──0.02 MB (00.00%) ── other-sundries
│  │  │    ├──0.11 MB (00.01%) -- layout
│  │  │    │  ├──0.10 MB (00.01%) ── style-sets
│  │  │    │  ├──0.01 MB (00.00%) ── pres-shell
│  │  │    │  ├──0.00 MB (00.00%) ── pres-contexts
│  │  │    │  └──0.00 MB (00.00%) ── rule-nodes
│  │  │    └──0.00 MB (00.00%) -- dom
│  │  │       ├──0.00 MB (00.00%) ── other [2]
│  │  │       └──0.00 MB (00.00%) ── element-nodes


Firefox 17 aurora.
(In reply to Boris Prpic from comment #15)
> I have 1 about:blank compartment for every session restored not loaded tab.

That's normal, see bug 681201.
The situation was improved recently on 64-bit platforms almost half of the memory usage has been get rid of, see bug 681201 comment 56.
Whiteboard: [MemShrink:P1] → [MemShrink:P2]
Is it possible bug 1041808 was responsible for this and we never made the connection? Can this now still be reproduced in Nightly?
Flags: needinfo?(n.nethercote)
> Is it possible bug 1041808 was responsible for this and we never made the
> connection?

That bug is about lots of tiny blank windows, like this:

>  │    │  ├────0.15 MB (00.01%) ++ top(about:blank, id=1001)

This bug is about a small number of large about:blank compartments, like this:

> │  ├───31.50 MB (13.62%) -- compartment([System Principal], about:blank)

They don't smell the same to me.
Flags: needinfo?(n.nethercote)

I no longer see this issue, and the memory reporter has changed significantly since this was reported.

Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.