Closed Bug 99168 Opened 25 years ago Closed 25 years ago

MLK: nsMsgMailNewsUrl leaks on reading imap messages.

Categories

(MailNews Core :: Networking: IMAP, defect)

x86
Windows NT
defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: naving, Assigned: naving)

Details

(Keywords: memory-leak)

Attachments

(3 files)

This is a pretty serious leak because every time user reads a message it leaks this object.
Summary: MLK: nsMsgMailNewsUrl leaks on reading imap messages. → MLK: nsMsgMailNewsUrl leaks on reading imap messages.
Attached patch proposed fix — — Splinter Review
The fix is not to set the URI for the mock Channel everytime we create an imapUrl. This causes the imapUrl to leak because in some instances, more specifically as shown below, they just need to know the url. If you set the url on mockChannel you will have to explicitly null it in order to destroy the circular reference, which never happens because the code below knows nothing about mockChannel. However, we do need to set the url on mockChannel, when we are running url using the imap connection, more specifically when we do GetImapConnectionAndLoadUrl(). This patch has been in my tree for a few days now and everything seems to work fine. cc mscott and bienvenu for review. nsImapUrlConstructor(nsISupports * 0x00000000, const nsID & {...}, void * * 0x0012e86c) line 38 + 132 bytes nsGenericFactory::CreateInstance(nsGenericFactory * const 0x05615490, nsISupports * 0x00000000, const nsID & {...}, void * * 0x0012e86c) line 59 + 21 bytes nsComponentManagerImpl::CreateInstance(nsComponentManagerImpl * const 0x00957c30, const nsID & {...}, nsISupports * 0x00000000, const nsID & {...}, void * * 0x0012e86c) line 1544 + 24 bytes nsComponentManager::CreateInstance(const nsID & {...}, nsISupports * 0x00000000, const nsID & {...}, void * * 0x0012e86c) line 3073 nsImapService::NewURI(nsImapService * const 0x04d90a9c, const char * 0x066ee970, nsIURI * 0x00000000, nsIURI * * 0x0012e990) line 3207 + 46 bytes nsIOService::NewURI(nsIOService * const 0x00a404c0, const char * 0x066ee970, nsIURI * 0x00000000, nsIURI * * 0x0012e990) line 694 + 35 bytes NS_NewURI(nsIURI * * 0x0012e990, const char * 0x066ee970, nsIURI * 0x00000000, nsIIOService * 0x00a404c0) line 81 + 24 bytes nsScriptSecurityManager::GetCodebasePrincipal(nsScriptSecurityManager * const 0x0286ee50, nsIURI * 0x066af5c4, nsIPrincipal * * 0x066eca18) line 1217 + 43 bytes nsDocument::GetPrincipal(nsDocument * const 0x066ec9b0, nsIPrincipal * * 0x0012ea90) line 739 + 37 bytes IsScriptEnabled(nsIDocument * 0x066ec9b0, nsIWebShell * 0x044ec314) line 2419 + 36 bytes HTMLContentSink::Init(nsIDocument * 0x066ec9b0, nsIURI * 0x066af5c4, nsIWebShell * 0x044ec314, nsIChannel * 0x066af400) line 2502 + 13 bytes NS_NewHTMLContentSink(nsIHTMLContentSink * * 0x0012f540, nsIDocument * 0x066ec9b0, nsIURI * 0x066af5c4, nsIWebShell * 0x044ec314, nsIChannel * 0x066af400) line 2318 + 24 bytes nsHTMLDocument::StartDocumentLoad(nsHTMLDocument * const 0x066ec9b0, const char * 0x02ad4ac8, nsIChannel * 0x066af400, nsILoadGroup * 0x044ed7c0, nsISupports * 0x044ec204, nsIStreamListener * * 0x0012fadc, int 1) line 868 + 67 bytes nsContentDLF::CreateDocument(const char * 0x02ad4ac8, nsIChannel * 0x066af400, nsILoadGroup * 0x044ed7c0, nsISupports * 0x044ec204, const nsID & {...}, nsIStreamListener * * 0x0012fadc, nsIContentViewer * * 0x0012f960) line 329 + 45 bytes nsContentDLF::CreateInstance(nsContentDLF * const 0x066ebfa0, const char * 0x02ad4ac8, nsIChannel * 0x066af400, nsILoadGroup * 0x044ed7c0, const char * 0x0012fa8c, nsISupports * 0x044ec204, nsISupports * 0x00000000, nsIStreamListener * * 0x0012fadc, nsIContentViewer * * 0x0012f960) line 219 + 37 bytes nsDocShell::NewContentViewerObj(nsDocShell * const 0x044ec1e0, const char * 0x0012fa8c, nsIRequest * 0x066af400, nsILoadGroup * 0x044ed7c0, nsIStreamListener * * 0x0012fadc, nsIContentViewer * * 0x0012f960) line 3929 + 101 bytes nsDocShell::CreateContentViewer(nsDocShell * const 0x044ec1e0, const char * 0x0012fa8c, nsIRequest * 0x066af400, nsIStreamListener * * 0x0012fadc) line 3813 + 60 bytes nsDSURIContentListener::DoContent(nsDSURIContentListener * const 0x044ec050, const char * 0x0012fa8c, int 0, nsIRequest * 0x066af400, nsIStreamListener * * 0x0012fadc, int * 0x0012fa70) line 121 + 33 bytes nsDocumentOpenInfo::DispatchContent(nsIRequest * 0x066af400, nsISupports * 0x00000000) line 352 + 93 bytes
Status: NEW → ASSIGNED
Attachment #49155 - Flags: superreview+
Comment on attachment 49155 [details] [diff] [review] proposed fix sr=mscott for the trunk. We might expose some crashers where we don't have a url and we need one off the mock channel. But I couldn't trigger any when running with the patch.
fix checked in on trunk.
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
Using the log as criteria, this looks fixed to me. Verified FIXED, latest trunk CVS pull on Win32.
Status: RESOLVED → VERIFIED
I think this fix broke reading imap messages with inline images. I'm going to try backing out this locally, and if it fixes the problem, I'll check in the backout and re-open this bug.
Re-opening, since I'm backing out the fix. I'll take the bug if you want, Navin.
Status: VERIFIED → REOPENED
Resolution: FIXED → ---
I will look into it again.
David, have you backed out the fix. I have a fix in hand that will fix the inline attachments problem. I am testing the fix right now.
Status: REOPENED → ASSIGNED
yes, I just checked it in - had to wait for the tree to open :-( You should check view | message source too with your change.
Attached patch fix — — Splinter Review
The fix is to initializeURI for mockChannel when we are creating a new channel. David, can i get r/sr ? It works for view | Messages. I will do some more test before I land.
Let me try it out later - I'm still waiting for the build. This isn't the kind of fix that I can just code review, because it really just requires lots of testing.
Comment on attachment 51163 [details] [diff] [review] fix looks good so far, haven't seen any regressions.
Attachment #51163 - Flags: review+
how about testing printing...just for kicks....try printing with an image too.
printing works fine too.
Comment on attachment 51163 [details] [diff] [review] fix sr=mscott then. thanks for trying out printing.
Attachment #51163 - Flags: superreview+
fixed again.
Status: ASSIGNED → RESOLVED
Closed: 25 years ago → 25 years ago
Resolution: --- → FIXED
I believe this fixed Bug 100712 ... I'm marking it as resolved...
Verified FIXED (again).
Status: RESOLVED → VERIFIED
Product: MailNews → Core
Product: Core → MailNews Core
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: