Closed
Bug 605908
Opened 15 years ago
Closed 15 years ago
test_parent.js leaks objects
Categories
(Core :: Networking: Cookies, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: jdm, Assigned: dwitte)
References
Details
(Whiteboard: [xpcshell-leak])
Attachments
(4 files, 1 obsolete file)
|
2.49 KB,
text/plain
|
Details | |
|
3.20 KB,
patch
|
jdm
:
review+
sdwilsh
:
approval2.0+
|
Details | Diff | Splinter Review |
|
1.63 KB,
text/plain
|
Details | |
|
1.31 KB,
patch
|
jdm
:
review+
sdwilsh
:
approval2.0+
|
Details | Diff | Splinter Review |
No description provided.
| Assignee | ||
Comment 1•15 years ago
|
||
Looks like we're leaking an entire nsPermissionManager. An observer's probably holding on to the whole thing and never releasing it.
Probably a result of Alon's work. Any ideas?
| Reporter | ||
Comment 2•15 years ago
|
||
I have a patch I can't test (no ipc tests on mac).
| Reporter | ||
Comment 3•15 years ago
|
||
| Reporter | ||
Comment 4•15 years ago
|
||
Try says that test_parent times out with this patch :(
Comment 5•15 years ago
|
||
Since
const messages = ["TESTING:Stage2", "TESTING:Stage3"];
then
for (let message in messages)
mM.addMessageListener(message, messageListener);
should be
messages.forEach(function(message) {
mM.addMessageListener(message, messageListener);
});
(the JavaScript for-in operator claims another victim).
But, this still doesn't fix the leak, hmm. Do we even care about such leaks - are xpcshell tests supposed to not leak? This doesn't show up as an orange anywhere that I can see.
Comment 6•15 years ago
|
||
(In reply to comment #5)
> But, this still doesn't fix the leak, hmm. Do we even care about such leaks -
> are xpcshell tests supposed to not leak? This doesn't show up as an orange
> anywhere that I can see.
We do care, but don't presently have a way to go orange when one test starts leaking (it's an all or nothing thing right now, which is sucky).
Comment 7•15 years ago
|
||
(In reply to comment #6)
> We do care, but don't presently have a way to go orange when one test starts
> leaking (it's an all or nothing thing right now, which is sucky).
Hmm, isn't that the same situation as we have in mochitests? But there we do report leaks for some reason?
Anyhow, the leak happens here even with
var pm = Cc["@mozilla.org/permissionmanager;1"].getService(Ci.nsIPermissionManager);
pm = null;
(and not using pm later). So it isn't the fault of the script. Must be something with nsPermissionManager::GetSingleton(). Is there a difference in how xpcshell tests destroy singletons for services, compared to running firefox normally? Does cycle collection etc. happen in xpcshell tests?
Comment 8•15 years ago
|
||
(In reply to comment #7)
> Hmm, isn't that the same situation as we have in mochitests? But there we do
> report leaks for some reason?
xpcshell runs each test in a new process, whereas mochitest is all the same.
> Anyhow, the leak happens here even with
>
> var pm =
> Cc["@mozilla.org/permissionmanager;1"].getService(Ci.nsIPermissionManager);
> pm = null;
>
> (and not using pm later). So it isn't the fault of the script. Must be
> something with nsPermissionManager::GetSingleton(). Is there a difference in
> how xpcshell tests destroy singletons for services, compared to running firefox
> normally? Does cycle collection etc. happen in xpcshell tests?
That's...neat. dwitte owns that code; perhaps he has some insight here.
| Assignee | ||
Comment 9•15 years ago
|
||
ContentParent is leaking the permission manager. Patch coming up.
| Assignee | ||
Comment 11•15 years ago
|
||
(Alon, want to test it?)
Comment 12•15 years ago
|
||
The fix gets us most of the way, but some leakiness still remains, see attachment
Note that leaking PObjectWrapperChild happens even if removing all calls to nsPermissionManager in the tests - so perhaps a separate issue?
Not sure how we could be leaking an nsPermission. Somewhere in the IPC conversion code? Looks ok to me though...
Updated•15 years ago
|
Attachment #484914 -
Attachment mime type: application/octet-stream → text/plain
Comment 13•15 years ago
|
||
Another thing, the code that is fixed in |fix| was written based off of
http://mxr.mozilla.org/mozilla-central/source/netwerk/cookie/nsCookieService.h#290
- so is that code in error as well?
| Reporter | ||
Comment 14•15 years ago
|
||
The PObjectWrapperChild leak is a known issue being tracked in bug 599713.
Updated•15 years ago
|
| Assignee | ||
Comment 15•15 years ago
|
||
(In reply to comment #12)
>Not sure how we could be leaking an nsPermission. Somewhere in the IPC
>conversion code? Looks ok to me though...
http://mxr.mozilla.org/mozilla-central/source/dom/ipc/ContentParent.cpp#229
http://mxr.mozilla.org/mozilla-central/source/dom/ipc/ContentParent.cpp#238
Both of those will leak -- the methods return an addrefed pointer, which you're never releasing.
(In reply to comment #13)
> - so is that code in error as well?
Nope. In the places we use it, we assign it into an already_AddRefed helper, which makes the nsCOMPtr not addref it again. (But it will release it.)
| Assignee | ||
Comment 16•15 years ago
|
||
I should've caught these in review. Sorry :(
I checked most of the other patches you've committed to m-c, and couldn't find any other leaky code, so I think we're OK.
| Reporter | ||
Comment 17•15 years ago
|
||
Comment on attachment 484887 [details] [diff] [review]
fix
Boom. Headshot.
Attachment #484887 -
Flags: review?(azakai) → review+
| Reporter | ||
Comment 18•15 years ago
|
||
Comment on attachment 485056 [details] [diff] [review]
second fix
DOUBLE HEADSHOT
Attachment #485056 -
Flags: review?(azakai) → review+
| Reporter | ||
Updated•15 years ago
|
Attachment #484776 -
Attachment is obsolete: true
Updated•15 years ago
|
Attachment #484887 -
Flags: approval2.0+
Updated•15 years ago
|
Attachment #485056 -
Flags: approval2.0+
| Assignee | ||
Comment 19•15 years ago
|
||
http://hg.mozilla.org/mozilla-central/rev/e674806e6889
http://hg.mozilla.org/mozilla-central/rev/0434c3cf6279
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•