Closed Bug 498323 Opened 15 years ago Closed 15 years ago

Several IMAP tests have reported leak (including nsRDFResource)

Categories

(MailNews Core :: Networking: IMAP, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Thunderbird 3.0b3

People

(Reporter: standard8, Assigned: Bienvenu)

References

Details

(Keywords: memory-leak)

Attachments

(3 files, 1 obsolete file)

Attached file Typical leak log
After part 2 of bug 438922 has landed to clean up the leak logs, several of the imap tests still leak. nsRDFResource and RDFServiceImpl are notable highlights.

Current failures are:

test_nsIMsgFolderListenerIMAP.js
test_imapContentLength.js
test_bug460636.js

Typical logs attached.
Flags: wanted-thunderbird3+
No longer depends on: 438922
taking
Assignee: nobody → bienvenu
Status: NEW → ASSIGNED
Attached patch proposed fix (obsolete) — Splinter Review
the tests are assuming the uri is user@localhost, but we're not creating the account with the correct name. This causes RDF to create new imap folders and use those, but those folders aren't hooked up to the server/account, and thus don't get cleaned up...
Attachment #384182 - Flags: review?(bugzilla)
test_imapContentLength.js seems like it might still leaking - preliminary investigation shows that it's the imap archive folder, of all folders, that's leaking - I think this gets instantiated because it's the default folder for the imap server.

It doesn't seem to leak when I do a check-one, but when I check all, that test leaks. Since that doesn't make a lot of sense, I might be a bit confused.
Comment on attachment 384182 [details] [diff] [review]
proposed fix

With the patch applied, I'm seeing test_nsIMsgFolderListenerIMAP.js hanging part way through. I haven't had time to debug yet.

FYI the leak on test_compactOfflineStore.js is still always present, regardless of if I do check-one or xpcshell-tests (note check-interactive doesn't show leaks).
Attachment #384182 - Flags: review?(bugzilla) → review-
very odd - I wasn't seeing that before, but now I do see it when I do a check-one.
the imap folder listener test was working around a bug caused by the bad account definition, and listening for the deletion of the inbox. Removing that work-around fixed the hang for me.
Attachment #384182 - Attachment is obsolete: true
Attachment #384238 - Flags: review?(bugzilla)
(In reply to comment #4)

> FYI the leak on test_compactOfflineStore.js is still always present, regardless
> of if I do check-one or xpcshell-tests (note check-interactive doesn't show
> leaks).

Is that on the mac? On windows, at least with my debug build, it only leaks with xpcshell-tests. I suspect it has to do with the timing of shutting down the imap server/threads. I notice that the test_imapContentLength.js test doesn't leak and it cleans up the server on a timeout (though my first attempt at making test_compactOfflineStore.js hung).
(In reply to comment #7)
> (In reply to comment #4)
> 
> > FYI the leak on test_compactOfflineStore.js is still always present, regardless
> > of if I do check-one or xpcshell-tests (note check-interactive doesn't show
> > leaks).
> 
> Is that on the mac? On windows, at least with my debug build, it only leaks
> with xpcshell-tests. I suspect it has to do with the timing of shutting down
> the imap server/threads. I notice that the test_imapContentLength.js test
> doesn't leak and it cleans up the server on a timeout (though my first attempt
> at making test_compactOfflineStore.js hung).

This is on mac, but it is test_imapContentLength.js that is leaking, not what I said in my comment.
Comment on attachment 384238 [details] [diff] [review]
add fix for hang in folder listener imap test - checked in.

r=Standard8. So this leaves us with the reported leaks covered by bug 498307, and the test_imapContentLength.js set.

We can move test_imapContentLength.js if you want, or we can try and fix it here.
Attachment #384238 - Flags: review?(bugzilla) → review+
I'm not seeing the test_imapContentLength.js leak, though from the Tinderbox logs, it sure looks like the same kind of leak. I'd just leave this open - I'll try it on my mac at some point...
Attachment #384238 - Attachment description: add fix for hang in folder listener imap test → add fix for hang in folder listener imap test - checked in.
Attached patch proposed fixSplinter Review
The leak appears to be caused by a combination of factors - we default to an imap Archives folder, and when imap folder discovery is done, we set the special flags on the special folders based on the prefs. Because of the nature of RDF, this gives us an Archives folder that's free floating - it has no parent, and is nobody's child. Setting the Archives flag on this folder causes us to open the db. We don't close the db at shutdown as we would normally because it's not in the folder hierarchy.  This fix makes it so we close the db right after opening it, in the case that we had a brand new profile (ReadDBFolderInfo does not have the value initialized from the folder cache like it would normally).

I'm not sure why the other imap tests don't run into this issue - maybe it's because this test doesn't do the performExpand() some of the other tests do.
Attachment #384344 - Flags: superreview?(bugzilla)
Attachment #384344 - Flags: review?(bugzilla)
Attachment #384344 - Flags: superreview?(bugzilla)
Attachment #384344 - Flags: superreview+
Attachment #384344 - Flags: review?(bugzilla)
Attachment #384344 - Flags: review+
Comment on attachment 384344 [details] [diff] [review]
proposed fix

Hmm, I did mean to say I wonder if it is worth having a brief comment to explain why we're doing the ReadDBFolderInfo then the check for dbWasOpen.
I've added a comment as to why we're remembering if the db was open or not before the function is called...
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 3.0b3
Flags: in-testsuite+
(In reply to comment #7)
> (In reply to comment #4)
> 
> > FYI the leak on test_compactOfflineStore.js is still always present, regardless
> > of if I do check-one or xpcshell-tests (note check-interactive doesn't show
> > leaks).
> 
> Is that on the mac? On windows, at least with my debug build, it only leaks
> with xpcshell-tests.

I filed bug 503762.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: