Closed
Bug 200094
Opened 22 years ago
Closed 22 years ago
FTP control connection-related leaks
Categories
(Core Graveyard :: Networking: FTP, defect)
Core Graveyard
Networking: FTP
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: bryner, Assigned: dougt)
Details
(Keywords: memory-leak)
Attachments
(2 files)
842 bytes,
patch
|
Details | Diff | Splinter Review | |
3.15 KB,
patch
|
dougt
:
review+
bryner
:
superreview+
|
Details | Diff | Splinter Review |
We're no longer leaking nsFtpControlConnections, but its socket transport and
some related objects are leaking. The reason is that there's a circular
reference. I'll try my best to illustrate:
nsFtpControlConnection
|
| (mOutStream)
V
nsPipeOutputStream
^
| (mSource)
|
nsStreamCopierIB
^ |
(mNotify) | | (mSink)
| V
nsSocketOutputStream
So, without any explicit cleanup, the SocketOutputStream (really
nsSocketTransport) and the StreamCopierIB leak each other, causing the
nsPipeOutputStream (really nsPipe) and the SocketTransportService to leak.
This might be a symptom of a more generic problem (shouldn't these objects be
able to clean up after themselves when you release all references to them?)
I'll leave that question for Darin and Doug. We can easily break the cycle in
this case though, by calling Close on mOutStream in
nsFtpControlConnection::Disconnect.
Reporter | ||
Comment 1•22 years ago
|
||
Reporter | ||
Comment 2•22 years ago
|
||
Comment on attachment 119053 [details] [diff] [review]
explicitly break the cycle
Feel free to smack this down if there's a way to fix this generically.
Attachment #119053 -
Flags: superreview?(darin)
Attachment #119053 -
Flags: review?(dougt)
Reporter | ||
Comment 3•22 years ago
|
||
The above diagram is somewhat ambiguous... it's the nsPipeInputStream, not the
nsPipeOutputStream, that's the nsStreamCopierIB's |mSource|. But they're both
really just the pipe object.
Comment 4•22 years ago
|
||
bryner:
zero'ing out mOutStream should be equivalent to calling Close on the output
stream. notice that the pipe's output and input streams each have separate
reference counts. though there is an overall reference count for the entire
pipe object, there are separate read and write ref counts. when those
individual ref counts go to zero, Close is called on the respective input or
output stream. so, it sounds like there is an extra reference to the pipe's
output stream somewhere.
Comment 5•22 years ago
|
||
this patch also breaks the cycle. i'm still not entirely sure why the original
code doesn't work. but, something about closing mOutStream first is critical.
Reporter | ||
Updated•22 years ago
|
Attachment #119053 -
Flags: superreview?(darin)
Attachment #119053 -
Flags: review?(dougt)
Reporter | ||
Updated•22 years ago
|
Attachment #119104 -
Flags: superreview+
Attachment #119104 -
Flags: review?(dougt)
Assignee | ||
Updated•22 years ago
|
Attachment #119104 -
Flags: review?(dougt) → review+
Reporter | ||
Comment 6•22 years ago
|
||
At Darin's request I opened bug 200219 about the more general problem. I went
ahead and checked in this patch.
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Updated•1 year ago
|
Product: Core → Core Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•