Closed Bug 21650 Opened 25 years ago Closed 24 years ago

Socket Service and associated thread are leaked

Categories

(Core :: Networking, defect, P3)

x86
Other
defect

Tracking

()

VERIFIED FIXED

People

(Reporter: mscott, Assigned: warrensomebody)

References

Details

(Keywords: memory-leak)

Warren,
I was looking at the bloat logs today and I noticed that the socket service gets
leaked along with the thread it creates.

Here's why:
1) The socket service calls NS_NewThread which returns a ref counted nsIThread.
2) the socket passes itself in as an nsIRunnable instance to the thread. The
thread owns this instance.

This forms a circular reference between the two objects that is never broken.
The thread won't call the socket's shutdown method (which releases mThread)
because the thread never goes away.

At least that's what I think is going on.
Component: Networking-Core → Networking
Moving to proper new component.
Target Milestone: M15
Keywords: mlk
Summary: [MLK] Socket Service and associated thread are leaked → Socket Service and associated thread are leaked
Moving non-essential, non-beta2 and performance-related bugs to M17.
Target Milestone: M15 → M17
Target Milestone: M17 → M18
I haven't proved that a circular reference exist, but by calling
nsSocketTransportService::Shutdown(), the transport thread is exited and the
nsSocketTransportService destructs as it should.  

The way I trigger the Shutdown is by clicking on the 'disconnect network' icon
at the bottom of the browser before shutting down the browser. Is there some
place in the browser shutdown sequence that is suppose to call the socket
transport service's Shutdown() method?
Rusty: This sounds like the same bug Gordon was tracking at one point (I can't 
find the bug number though). CSS was holding onto a global reference to the IO 
service, so the socket transport thread, dns thread, etc. were all being leaked 
on shutdown. 

Gordon: What happened with that bug?
Yes, this sounds like a duplicate of bug 17390.  I would mark it as a duplicate, 
but that bug has a target milestone of "Future", which makes it sound like no one 
is going to get to it.
Depends on: 17390
*** Bug 43488 has been marked as a duplicate of this bug. ***
This is _not_ a dup of 17390. Current bloat log shows no CSS*, nsCSS* or 
nsHTML* objects leaking. I think mscott is on to something with this one.
fix checked in: we were re-entering the service manager while LateInit()-ing the
socket transport service.
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
verified
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.