Last Comment Bug 369918 - Crash Loading a Saved Search Folder [ nsMsgQuickSearchDBView::OnSearchDone]
: Crash Loading a Saved Search Folder [ nsMsgQuickSearchDBView::OnSearchDone]
: crash, verified1.8.1.17
Product: MailNews Core
Classification: Components
Component: Backend (show other bugs)
: Trunk
: All All
P3 critical (vote)
: mozilla1.9.1a1
Assigned To: Magnus Melin
: 445446 (view as bug list)
Depends on:
  Show dependency treegraph
Reported: 2007-02-09 14:29 PST by Scott MacGregor
Modified: 2008-09-25 14:18 PDT (History)
7 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---

proposed fix (1.21 KB, patch)
2008-07-12 14:18 PDT, Magnus Melin
mozilla: review+
mozilla: superreview+
Details | Diff | Splinter Review
proposed fix (1.8 branch) (1.17 KB, patch)
2008-07-21 12:45 PDT, Magnus Melin
dmose: approval1.8.1.17+
Details | Diff | Splinter Review

Description User image Scott MacGregor 2007-02-09 14:29:14 PST
Using today's branch nightly on Windows.

I was running testing something out. Then I went back to Thunderbird 2, clicked on a saved search folder that spans multiple accounts and crashed. Restarting and I still crashed.

Note: this sure does look a lot like Bug 352287


nsMsgQuickSearchDBView::OnSearchDone  [mozilla/mailnews/base/src/nsMsgQuickSearchDBView.cpp, line 270]
nsMsgSearchSession::NotifyListenersDone  [mozilla/mailnews/base/search/src/nsMsgSearchSession.cpp, line 608]
nsMsgSearchSession::TimerCallback  [mozilla/mailnews/base/search/src/nsMsgSearchSession.cpp, line 540]
nsTimerImpl::Fire  [mozilla/xpcom/threads/nsTimerImpl.cpp, line 394]
Comment 1 User image David :Bienvenu 2007-02-09 14:34:05 PST
if your saved search folder spans multiple accounts, why whould we be in nsMsgQuickSearchDBView::OnSearchDone? Were you in a view in the saved search folder?
Comment 2 User image Scott MacGregor 2007-02-09 14:41:33 PST
Hmm, I could have sworn it used to span multiple folders (not multiple accounts). 

After running in a debug trunk build, I'm able to load the folder again without crashing and verified that it's just searching a single folder.

I think something weird happened when I went back to 1.5 and then back to tb2. The first time I ran none of my virtual folders loaded, then the second time I ran, I got a bunch of saved search folders that I haven't seen in a long time. Then those disappeared after a couple crashes loading that one search.

David, can you try running 1.5 and seeing if you notice anything weird the first time you run tb2 after that?
Comment 3 User image David :Bienvenu 2007-02-09 14:45:38 PST
I run 1.5 quite a bit more than I'd like to :-) and I haven't seen this issue. But I really only have one saved search that I use regularly, which checks all my inboxes and filter targets for new mail. I know I've used that with 1.5, because I notice how slow it is compared to 2.0...

anything special about the folders the saved search searched over? e.g., folder names that needed encoding? or the saved search itself?
Comment 4 User image Iain Hallam 2007-06-06 06:36:31 PDT
Just seen this on TB2.0.0.0 on upgrading from TB1.5.0.12:

This doesn't happen with a blank profile created in TB2.
Comment 5 User image Iain Hallam 2007-06-07 04:32:31 PDT
To update, I have today installed TB2 on a different machine and, knowing about the problems I had yesterday, started with a blank profile. Same bug manifested itself, unfortunately:
Comment 6 User image Wayne Mery (:wsmwk, NI for questions) 2008-02-13 19:14:50 PST
Ian, have you seen the crash since with newer v2?
Comment 7 User image Tom Simnett 2008-06-22 10:15:04 PDT
I have now started seeing this issue. I used to have a search folder that did a basic search on "From:" and Tags contains. The search itself works fine, and the Search Folder is created. Clicking on the Folder however produces a crash. All other search folders seem to work ok, except for this one. And the name of it doesn't appear to be relevant.

Comment 8 User image Magnus Melin 2008-07-12 14:18:37 PDT
Created attachment 329256 [details] [diff] [review]
proposed fix

RefreshCache can fail at least via nsMsgDatabase::GetSearchResultsTable() and by OOM
Comment 9 User image David :Bienvenu 2008-07-14 10:53:25 PDT
Comment on attachment 329256 [details] [diff] [review]
proposed fix

I think OOM is the only realistic way it can fail, so I don't know that this patch is going to fix the problem. RefreshCache tells GetSearchResultsTable to create the table if it's missing and that generally succeeds, bar OOM. But, we should check for the error.
Comment 10 User image Magnus Melin 2008-07-15 10:49:10 PDT
Checking in mailnews/base/src/nsMsgQuickSearchDBView.cpp;
/cvsroot/mozilla/mailnews/base/src/nsMsgQuickSearchDBView.cpp,v  <--  nsMsgQuickSearchDBView.cpp
new revision: 1.37; previous revision: 1.36

->FIXED (hopefully, if it still crashes we can open a new bug for that)
Comment 11 User image Magnus Melin 2008-07-21 12:39:17 PDT
*** Bug 445446 has been marked as a duplicate of this bug. ***
Comment 12 User image Magnus Melin 2008-07-21 12:45:16 PDT
Created attachment 330627 [details] [diff] [review]
proposed fix (1.8 branch)

Just adding an rv check, should be very safe for branch too.
Comment 13 User image Patrick 2008-08-07 19:54:11 PDT
Any news on this? When will the fix be in a release version? This bug effectively renders the (great) 'Saved Search Folder' feature unusable for me.
Comment 14 User image Phil Ringnalda (:philor) 2008-08-15 16:17:50 PDT
Magnus: stepping on your toes with a checkin-needed, since the branch code freeze is in eight hours.
Comment 15 User image Phil Ringnalda (:philor) 2008-08-15 18:48:10 PDT
Comment 16 User image Magnus Melin 2008-08-15 22:22:40 PDT
Thx Phil!
Patrick: this will be in thunderbird
Comment 17 User image Patrick 2008-08-15 23:45:56 PDT
Great news! :)
Comment 18 User image Al Billings [:abillings] 2008-09-22 15:03:21 PDT
I can't reproduce this bug cleanly. Can someone verify the fix in the release candidate for TB at ?
Comment 19 User image Patrick 2008-09-25 03:16:06 PDT
(In reply to comment #18)
> I can't reproduce this bug cleanly. Can someone verify the fix in the release
> candidate for TB at
> ?

It also doesn't happen in 100% of the times I click on a search folder for me. I think when Thunderbird is freshly started, it's more likely to happen.

Just now I did some testing:
TB crashed (verified, multiple times).
TB (downloaded a few minutes ago, used the same profile): I tried ~30 times, restarted it, restarted the whole system, tried again - no crash. So: seems to work!

Thanks a lot for fixing this! :)
Comment 20 User image Al Billings [:abillings] 2008-09-25 14:18:56 PDT
Marking this as verified then. I sounds like the fix worked. :-)

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