Closed
Bug 1343863
Opened 8 years ago
Closed 8 years ago
precompile_cache.js leaks the places shutdown blockers
Categories
(Toolkit :: Places, defect)
Toolkit
Places
Tracking
()
RESOLVED
FIXED
mozilla55
Tracking | Status | |
---|---|---|
firefox55 | --- | fixed |
People
(Reporter: ehsan.akhgari, Assigned: ehsan.akhgari)
References
Details
Attachments
(1 file, 1 obsolete file)
See this try job, for example:
https://archive.mozilla.org/pub/firefox/try-builds/eakhgari@mozilla.com-2d216591dbf733fdb1acf11aa3065bdaa46dbfc0/try-linux64-st-an-debug/try-linux64-st-an-debug-bm76-try1-build6677.txt.gz
STR:
$ export XPCOM_MEM_LEAK_LOG=1
$ ./objdir/dist/bin/xpcshell -g objdir/dist/bin/ -a objdir/dist/bin/ -f toolkit/mozapps/installer/precompile_cache.js -e 'precompile_startupcache("resource://gre/");'
The issue is that there is no profile directory, and InitDatabaseFile() fails as a result, which makes us bail out early from here: <http://searchfox.org/mozilla-central/rev/31b6089ce26fa76459642765115605d50a6c67b4/toolkit/components/places/Database.cpp#458>
But this is before we have set up our shutdown blockers: <http://searchfox.org/mozilla-central/rev/31b6089ce26fa76459642765115605d50a6c67b4/toolkit/components/places/Database.cpp#500>. So there is nothing that the script can do in order to break the cycle between the Database object and their shutdown blockers, so we leak them all.
== BloatView: ALL (cumulative) LEAK STATISTICS, default process 33502
|<----------------Class--------------->|<-----Bytes------>|<----Objects---->|
| | Per-Inst Leaked| Total Rem|
0 |TOTAL | 53 2392| 211437 42|
6 |BackstagePass | 104 312| 722 3|
17 |ClientsShutdownBlocker | 80 80| 1 1|
19 |ConnectionShutdownBlocker | 88 88| 1 1|
25 |Database | 248 248| 1 1|
65 |PlacesShutdownBlocker | 72 144| 2 2|
114 |XPCNativeInterface | 56 112| 1784 2|
115 |XPCNativeMember | 16 32| 39659 2|
116 |XPCNativeSet | 32 64| 1106 2|
117 |XPCWrappedNative | 96 480| 7603 5|
118 |XPCWrappedNativeProto | 40 160| 2877 4|
120 |XPCWrappedNativeTearOff | 32 160| 10645 5|
173 |nsJSID | 56 112| 310 2|
175 |nsJSPrincipals | 24 24| 4 1|
183 |nsMainThreadPtrHolder<T> | 24 24| 2 1|
220 |nsStringBuffer | 8 8| 49410 1|
226 |nsTArray_base | 8 32| 45466 4|
253 |nsXPCWrappedJS | 120 120| 101 1|
254 |nsXPCWrappedJSClass | 72 72| 10 1|
259 |xptiInterfaceInfo | 40 120| 270 3|
nsTraceRefcnt::DumpStatistics: 260 entries
The leak goes away if we Shutdown() before bailing out, due to Shutdown() breaking that cycle for us.
Assignee | ||
Comment 1•8 years ago
|
||
Attachment #8842858 -
Flags: review?(mak77)
Comment 2•8 years ago
|
||
Comment on attachment 8842858 [details] [diff] [review]
Make sure that places Database object doesn't get leaked if the profile folder doesn't exist or is locked
Review of attachment 8842858 [details] [diff] [review]:
-----------------------------------------------------------------
::: toolkit/components/places/Database.cpp
@@ +459,5 @@
> +
> + // If we bail out early here without doing anything else, the Database object
> + // will leak due to the cycle between the shutdown blockers and itself, so
> + // let's break the cycle first.
> + Shutdown();
This may be fine, but looks like any failure in Init() will in general cause this.
I wonder if we should rather assign to mClientsShutdown and mConnectionShutdown just at the end of the Init() function, before the final return NS_OK;
Comment 3•8 years ago
|
||
Or at least where we add the blockers, later in Init()
Assignee | ||
Comment 4•8 years ago
|
||
The current code doesn't handle mConnectionShutdown being null, and Database::GetClientsShutdow() expects mClientsShutdown to be non-null. But you're right about the other early bail outs from this function.
New patch coming up!
Assignee | ||
Comment 5•8 years ago
|
||
Attachment #8843797 -
Flags: review?(mak77)
Assignee | ||
Updated•8 years ago
|
Attachment #8842858 -
Attachment is obsolete: true
Attachment #8842858 -
Flags: review?(mak77)
Comment 6•8 years ago
|
||
Comment on attachment 8843797 [details] [diff] [review]
Make sure that places Database object doesn't get leaked if the profile folder doesn't exist or is locked
Review of attachment 8843797 [details] [diff] [review]:
-----------------------------------------------------------------
LGTM
Attachment #8843797 -
Flags: review?(mak77) → review+
Pushed by eakhgari@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/1d1b4db2ae35
Make sure that places Database object doesn't get leaked if the profile folder doesn't exist or is locked; r=mak
Comment 8•8 years ago
|
||
bugherder |
Status: NEW → RESOLVED
Closed: 8 years ago
status-firefox55:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
You need to log in
before you can comment on or make changes to this bug.
Description
•