Closed Bug 100245 Opened 25 years ago Closed 4 years ago

leaking nsNNTPProtocol objects when objects get interrupted

Categories

(MailNews Core :: Networking: NNTP, defect)

x86
Windows 2000
defect
Not set
minor

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: sspitzer, Unassigned)

Details

(Keywords: memory-leak, Whiteboard: [patchlove][has draft patch][needs new assignee])

Attachments

(1 file)

leaking nsNNTPProtocol objects when objects get interrupted see bug #59449. pressing space bar and holding it on netscape.test on news.mozilla.org, I created 24 protocol instances, and only destroyed one.
Attaching a patch which seems to help with this problem. (I actually had this in my local tree because rfc977 prefers sending a QUIT when closing a transaction).
Keywords: patch
Attached patch Patch — — Splinter Review
All other protocols inheriting from nsMsgProtocol that implements ::Cancel calls back to nsMsgProtocol::Cancel() ... Not sure why, but it might be a good idea to do the same with nsNNTPProtocol. Phil?
Håkan, you're forcing me to think about how my patch works! My simplistic reasoning was as follows: 1) Calling nsMsgProtocol::Cancel releases the TCP connection. This is all one needs to do to kill, for example, an HTTP transaction. 2) Calling CloseConnection sends a QUIT to the news server, which then releases the TCP connection. This is the preferred method according to rfc977. In both cases the TCP connection gets released. For some reason, 2) has the pleasant side-effect of not leaking objects, but I don't know why.
Phil, wouldn't #2 also have the unpleasant side-effect of having us quit, start, quit, start... the connection if the user presses the spacebar to quickly switch messages? Sounds like that would be tough for the news-server if you send QUIT like 5 times in two seconds. :)
It's tough on the news server anyway if you just lean on the space bar - each message will require a *new* TCP connection. Don't do it :-)
Apropos leaning on the space bar - I tried this with Netscape 4.72. I was pleased to note that this trusty newsreader sends a QUIT on every connection. It also seems to limit the possible damage by restricting itself to a maximum of 3 TCP connections - maybe we should do the same?
Comment on attachment 49899 [details] [diff] [review] Patch After thorough thinking and digging, I think this patch is the right thing to do. r=hwaara
Attachment #49899 - Flags: review+
> It's tough on the news server anyway if you just lean on the space bar - each > message will require a *new* TCP connection. Don't do it :-) there as seperate bug for fixing that badness. see #100246. we already do the right thing (I think with a timed select) when we use the arrow keys to "zoom" over articles in the thread pane. we need to get "n" and space to do the same thing. > Apropos leaning on the space bar - I tried this with Netscape 4.72. I was > pleased to note that this trusty newsreader sends a QUIT on every connection. yes, we definitely want to make mozilla do that. disconnecting improperly is bad. see http://www.newsreaders.com/misc/twpierce/news/newsreader-manifesto.html > It also seems to limit the possible damage by restricting itself to a maximum > of 3 TCP connections - maybe we should do the same? yes, we want to. see bug #66150 I'll review this patch soon. I want to make sure we do the right thing when the user actually does cancels during a news action (by using the stop button)
Keywords: mlk, nsbeta1
need to fix this.
Keywords: nsbeta1 → nsbeta1+
Priority: -- → P2
Target Milestone: --- → mozilla0.9.8
sliding to 0.9.9
Target Milestone: mozilla0.9.8 → mozilla0.9.9
adding nsbeta1- and moving out. But if the patch is good, we should get take it.
Blocks: 122274
Status: NEW → ASSIGNED
Keywords: nsbeta1+ → nsbeta1-
Target Milestone: mozilla0.9.9 → mozilla1.2
Bienvenu or Seth, can you take a look at Phil's patch?
No longer blocks: 122274
sometime this year would be nice, *if* you can spare the time
Product: MailNews → Core
sorry for the spam. making bugzilla reflect reality as I'm not working on these bugs. filter on FOOBARCHEESE to remove these in bulk.
Assignee: sspitzer → nobody
Status: ASSIGNED → NEW
should still apply with just a line number change according to Phil.
QA Contact: stephend → networking.news
Comment on attachment 49899 [details] [diff] [review] Patch IIRC, we still need sr by a mailnews peer...
Attachment #49899 - Flags: superreview?(bienvenu)
Assignee: nobody → phil.anderton
this doesn't seem right - will anyone get a notification that the process was stopped, instead of completing normally? Are we sure this is still an issue? It looks to me like we call CloseConnection in the NNTP_ERROR case (though I'm not sure we'll get back into the state machine in that case).
Product: Core → MailNews Core
hwaara, phil, any possibility for refreshed patch, or comment?
Target Milestone: mozilla1.2alpha → ---
Comment on attachment 49899 [details] [diff] [review] Patch clearing review request pending answers to the questions I raised a while ago.
Attachment #49899 - Flags: superreview?(bienvenu)
Assignee: phil.anderton → nobody
Severity: normal → minor
Priority: P2 → --
Whiteboard: [patchlove][has draft patch][needs new assignee]

We have a connection pool, how many instances are created depends on max_cached_connections pref.

Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: