Some of nsDocument::mPrincipal objects are leaked

RESOLVED EXPIRED

Status

()

Core
DOM
RESOLVED EXPIRED
15 years ago
6 years ago

People

(Reporter: Leonid Romanov, Unassigned)

Tracking

1.0 Branch
x86
Linux
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(3 attachments)

(Reporter)

Description

15 years ago
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; Debian/1.3.3.20030317-1) Gecko/20030305 Galeon/1.3.3
Build Identifier: 

This is for Mozilla 1.0.2. I haven't checked 1.3 or trunk yet, but I'm going to
do it. Attached pages load each other via JavaScript. It seems that
nsStandardURL objects with URLs of pages aren't freed, even if you quit Mozilla.

Reproducible: Always

Steps to Reproduce:
1. Add some counting facility to nsStandardURL constructor/destructor
2. Load urltest1.html
-- Or ---
1. Put urltest1.html and urltest2.html into directory with the longest path
possible, like 2K of characters.
2. Load urltest1.html
Actual Results:  
Counter goes up and never stops.
-- Or ---
Mozilla consumes more and more memory until it crashes.

Expected Results:  
Counter stops going up on some value.
-- Or ---
Mozilla frees used memory eventually.
(Reporter)

Comment 1

15 years ago
Created attachment 118225 [details]
First test page (urltest1.html)
(Reporter)

Comment 2

15 years ago
Created attachment 118226 [details]
Second test page (urltest2.html)
(Reporter)

Updated

15 years ago
Version: Trunk → 1.0 Branch
(Reporter)

Comment 3

15 years ago
I looked at nsStandardURL object's refcounter. After object has been removed
from session history, refcounter value was 1. So, I think there is one
unbalanced AddRef somewhere.

Comment 4

15 years ago
-> whitebox qa
QA Contact: benc → ashishbhatt
(Reporter)

Comment 5

15 years ago
It is not network, but content. And not nsStandardURL, but
nsDocument::mPrincipal. nsDocument::mPrincipal is raw pointer in 1.0.2, not
nsCOMPtr as in Mozilla 1.3. So, it is released manually by NS_IF_RELEASE in
nsDocument destructor. The problem is that release happens before calling
mNodeInfoManager->DropDocumentReference(). But DropDocumentReference in turn
calls nsDocuments::GetPrincipal where mPrincipal is getting initialized and
AddRef'ed again. Hence the leak.
Changing bug's title and component.
Component: Networking → DOM Other
Summary: Some of nsStandardURL objects are leaked → Some of nsDocument::mPrincipal objects are leaked

Comment 6

15 years ago
please set the default owners when you hop components.
Assignee: dougt → dom_bugs
QA Contact: ashishbhatt → gerardok
(Reporter)

Comment 7

15 years ago
It was fixed on trunk. See 
http://bugzilla.mozilla.org/show_bug.cgi?id=170201
Fixed on the trunk, marking FIXED.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 15 years ago
Resolution: --- → FIXED
(Reporter)

Comment 9

15 years ago
But what about the branch? It must be fixed there too. And I'm going to provide
patch for 1.0 branch. Or I don't understand bug's life cycle and "fixed" means
something else?
In general, the focus has moved off the 1.0 branch, but if you still has an
interest in fixing this on the branch, then feel free to open up this bug and
provide a patch.
(Reporter)

Comment 11

15 years ago
Reopening: I've got a patch.
Status: RESOLVED → UNCONFIRMED
Resolution: FIXED → ---
(Reporter)

Comment 12

15 years ago
Created attachment 119085 [details] [diff] [review]
patch converting nsDocument::mPrincipal into an nsCOMPtr

This is a patch from bug 17201, backported to 1.0 branch.
(Reporter)

Comment 13

15 years ago
bug 170201, sorry.
Comment on attachment 119085 [details] [diff] [review]
patch converting nsDocument::mPrincipal into an nsCOMPtr

sr=jst
Attachment #119085 - Flags: superreview+
Asa, Brendan, are we still maintaining the 1.0 branch?  If so, should we land
this there?
This is an automated message, with ID "auto-resolve01".

This bug has had no comments for a long time. Statistically, we have found that
bug reports that have not been confirmed by a second user after three months are
highly unlikely to be the source of a fix to the code.

While your input is very important to us, our resources are limited and so we
are asking for your help in focussing our efforts. If you can still reproduce
this problem in the latest version of the product (see below for how to obtain a
copy) or, for feature requests, if it's not present in the latest version and
you still believe we should implement it, please visit the URL of this bug
(given at the top of this mail) and add a comment to that effect, giving more
reproduction information if you have it.

If it is not a problem any longer, you need take no action. If this bug is not
changed in any way in the next two weeks, it will be automatically resolved.
Thank you for your help in this matter.

The latest beta releases can be obtained from:
Firefox:     http://www.mozilla.org/projects/firefox/
Thunderbird: http://www.mozilla.org/products/thunderbird/releases/1.5beta1.html
Seamonkey:   http://www.mozilla.org/projects/seamonkey/
This bug has been automatically resolved after a period of inactivity (see above
comment). If anyone thinks this is incorrect, they should feel free to reopen it.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 15 years ago12 years ago
Resolution: --- → EXPIRED
You need to log in before you can comment on or make changes to this bug.