nsLoadGroup::RemoveChannel called for channels not in group




18 years ago
2 years ago


(Reporter: dbaron, Unassigned)



Firefox Tracking Flags

(Not tracked)


(Whiteboard: [necko-backlog])



18 years ago
I ran into this when debugging a leak.  It's not technically a bug (although it
could have some performance cost), but it seems wrong to me.  I discovered that
there are lots of calls to nsLoadGroup::RemoveChannel for channels that aren't
in the group.  I never investigated why this happens, but it happens all the
time when stopping page loads (hitting stop, hitting reload before a page is
loaded, clicking on a link before a page is loaded; especially on pages with
lots of images) or things like that.

I had the following assertions in nsLoadGroup.cpp, and the third one ("channel
not in group" fired all the time):

Index: nsLoadGroup.cpp
RCS file: /cvsroot/mozilla/netwerk/base/src/nsLoadGroup.cpp,v
retrieving revision 1.42
diff -u -d -r1.42 nsLoadGroup.cpp
--- nsLoadGroup.cpp	2000/10/26 06:34:02	1.42
+++ nsLoadGroup.cpp	2001/01/18 19:06:45
@@ -250,10 +250,12 @@
             // XXX: What should the context and error message be?
-            (void)RemoveChannel(channel, nsnull, status, nsnull);
+            rv = RemoveChannel(channel, nsnull, status, nsnull);
+            NS_ASSERTION(NS_SUCCEEDED(rv), "Failure removing channel.");
             // Cancel the channel...
             rv = channel->Cancel(status);
+            NS_ASSERTION(NS_SUCCEEDED(rv), "Failure cancelling channel.");
             // Remember the first failure and return it...
             if (NS_FAILED(rv) && NS_SUCCEEDED(firstError)) {
@@ -550,6 +552,7 @@
     // XXX this method incorrectly returns a bool
     rv = mChannels->RemoveElement(channel) ? NS_OK : NS_ERROR_FAILURE;
+    NS_ASSERTION(NS_SUCCEEDED(rv), "Channel not in group.");
     if (NS_FAILED(rv)) {
         PR_LOG(gLoadGroupLog, PR_LOG_ERROR,
                ("LOADGROUP [%x]: Unable to remove channel %x. Not in group!\n",


17 years ago
Target Milestone: --- → Future

Comment 1

17 years ago
mass move, v2.
qa to me.
QA Contact: tever → benc

Comment 2

16 years ago
moving neeti's futured bugs for triaging.
Assignee: neeti → new-network-bugs
hey david, found this very very old bug by accident and little comments, still an issue?
Flags: needinfo?(dbaron)

Comment 4

4 years ago
No idea, though the code is still around in nsLoadGroup::RemoveRequest:

    if (PL_DHASH_ENTRY_IS_FREE(entry)) {
        LOG(("LOADGROUP [%x]: Unable to remove request %x. Not in group!\n",
            this, request));

        return NS_ERROR_FAILURE;

so it's still certainly testable if we do this frequently.
Flags: needinfo?(dbaron)
Whiteboard: [necko-backlog]
A had a look into this:

Most probable cause (and it fits to description - clicking on a link before page is loaded) is that LoadGroup gets cancelled, it removes all requests and  it cancels all necko requests. When the necko requests get cancelled at the end an OnStopRequest is called which calls RemoveRequest again.

I would leave this as it is for now and close the bug.
Last Resolved: 2 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.