Closed
Bug 409458
Opened 18 years ago
Closed 8 years ago
Crash when adding listener to local folder [@ nsMsgDBFolder::NotifyItemAdded]
Categories
(MailNews Core :: Backend, defect)
Tracking
(thunderbird_esr6064+ verified, thunderbird64 verified)
RESOLVED
FIXED
Thunderbird 64.0
People
(Reporter: jminta, Assigned: jorgk-bmo)
References
Details
(Keywords: crash, sec-moderate, testcase, Whiteboard: [sg:moderate][critical hazard for unwary js code])
Crash Data
Attachments
(2 files, 3 obsolete files)
|
1.33 KB,
text/plain
|
Details | |
|
21.64 KB,
patch
|
jorgk-bmo
:
review+
darktrojan
:
feedback+
jorgk-bmo
:
approval-comm-esr60+
|
Details | Diff | Splinter Review |
The attach code will reliably crash Thunderbird when loaded. Note that the createSubfolder call is simply there to force some sort of notification to the listener. If, instead, you simply click on the local folder, you will also crash, but at nsMsgDBFolder::NotifyItemPropertyFlagChanged.
Apple crash report (just Thread 0):
Date/Time: 2007-12-21 15:30:22.431 -0500
OS Version: 10.4.11 (Build 8S2167)
Report Version: 4
Command: thunderbird-bin
Path: /Users/jminta/mozhack/mozilla/steel-mail-obj/dist/ThunderbirdDebug.app/Contents/MacOS/thunderbird-bin
Parent: launchd [1]
Version: 3.0a1pre (3.0a1pre)
PID: 5501
Thread: 0
Exception: EXC_BAD_ACCESS (0x0001)
Codes: KERN_INVALID_ADDRESS (0x0001) at 0x6165726f
Thread 0 Crashed:
0 libmail.dylib 0x13177901 nsMsgDBFolder::NotifyItemAdded(nsISupports*) + 185 (nsMsgDBFolder.cpp:4321)
1 libmail.dylib 0x132ec49f nsMsgLocalMailFolder::CreateSubfolder(nsAString_internal const&, nsIMsgWindow*) + 2305 (nsLocalMailFolder.cpp:791)
2 libxpcom_core.dylib 0x0133d2af NS_InvokeByIndex_P + 81 (xptcinvoke_unixish_x86.cpp:179)
3 libxpconnect.dylib 0x186087a4 XPCWrappedNative::CallMethod(XPCCallContext&, XPCWrappedNative::CallMode) + 6930 (xpcwrappednative.cpp:2342)
4 libxpconnect.dylib 0x18611367 XPC_WN_CallMethod(JSContext*, JSObject*, unsigned, long*, long*) + 411 (xpcwrappednativejsops.cpp:1467)
5 libmozjs.dylib 0x0104c302 js_Invoke + 2557 (jsinterp.c:1356)
6 libmozjs.dylib 0x01057e4b js_Interpret + 43121 (jsinterp.c:4176)
7 libmozjs.dylib 0x0104ca34 js_Execute + 785 (jsinterp.c:1601)
8 libmozjs.dylib 0x0101969d JS_EvaluateUCScriptForPrincipals + 198 (jsapi.c:4872)
9 libmozjs.dylib 0x01019531 JS_EvaluateScriptForPrincipals + 176 (jsapi.c:4840)
10 libxpconnect.dylib 0x1862dd9c mozJSSubScriptLoader::LoadSubScript(unsigned short const*) + 3120 (mozJSSubScriptLoader.cpp:283)
11 libxpcom_core.dylib 0x0133d2af NS_InvokeByIndex_P + 81 (xptcinvoke_unixish_x86.cpp:179)
12 libxpconnect.dylib 0x186087a4 XPCWrappedNative::CallMethod(XPCCallContext&, XPCWrappedNative::CallMode) + 6930 (xpcwrappednative.cpp:2342)
13 libxpconnect.dylib 0x18611367 XPC_WN_CallMethod(JSContext*, JSObject*, unsigned, long*, long*) + 411 (xpcwrappednativejsops.cpp:1467)
14 libmozjs.dylib 0x0104c302 js_Invoke + 2557 (jsinterp.c:1356)
15 libmozjs.dylib 0x01057e4b js_Interpret + 43121 (jsinterp.c:4176)
16 libmozjs.dylib 0x0104ca34 js_Execute + 785 (jsinterp.c:1601)
17 libmozjs.dylib 0x0101969d JS_EvaluateUCScriptForPrincipals + 198 (jsapi.c:4872)
18 libgklayout.dylib 0x29907a84 nsJSContext::EvaluateString(nsAString_internal const&, void*, nsIPrincipal*, char const*, unsigned, unsigned, nsAString_internal*, int*) + 994 (nsJSEnvironment.cpp:1518)
19 libgklayout.dylib 0x2997d41d nsJSThunk::EvaluateScript(nsIChannel*, PopupControlState, unsigned, nsPIDOMWindow*) + 4449 (nsJSProtocolHandler.cpp:331)
20 libgklayout.dylib 0x2997da5e nsJSChannel::EvaluateScript() + 144 (nsJSProtocolHandler.cpp:725)
21 libgklayout.dylib 0x29c9752e nsRunnableMethod<nsJSChannel>::Run() + 42 (nsThreadUtils.h:262)
22 libxpcom_core.dylib 0x0132a1ac nsThread::ProcessNextEvent(int, int*) + 646 (nsThread.cpp:511)
23 libxpcom_core.dylib 0x012cc8d0 NS_ProcessPendingEvents_P(nsIThread*, unsigned) + 124 (nsThreadUtils.cpp:180)
24 libwidget_mac.dylib 0x1bc9800d nsBaseAppShell::NativeEventCallback() + 71 (nsBaseAppShell.cpp:116)
25 libwidget_mac.dylib 0x1bc7ad96 nsAppShell::ProcessGeckoEvents(void*) + 210 (nsAppShell.mm:295)
26 com.apple.CoreFoundation 0x9082cf1a CFRunLoopRunSpecific + 1213
27 com.apple.CoreFoundation 0x9082ca56 CFRunLoopRunInMode + 61
28 com.apple.HIToolbox 0x92de7878 RunCurrentEventLoopInMode + 285
29 com.apple.HIToolbox 0x92de6eb9 ReceiveNextEventCommon + 184
30 com.apple.HIToolbox 0x92de6dd9 BlockUntilNextEventMatchingListInMode + 81
31 com.apple.AppKit 0x9328d485 _DPSNextEvent + 572
32 com.apple.AppKit 0x9328d076 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 137
33 com.apple.AppKit 0x93286dfb -[NSApplication run] + 512
34 libwidget_mac.dylib 0x1bc7a864 nsAppShell::Run() + 108 (nsAppShell.mm:568)
35 libtoolkitcomps.dylib 0x1c9f2272 nsAppStartup::Run() + 166 (nsAppStartup.cpp:182)
36 XUL 0x00217f81 XRE_main + 28873 (nsAppRunner.cpp:3149)
37 org.mozilla.thunderbird 0x00002c90 main + 598 (nsMailApp.cpp:87)
38 org.mozilla.thunderbird 0x000023c6 _start + 216
39 org.mozilla.thunderbird 0x000022ed start + 41
| Reporter | ||
Comment 1•18 years ago
|
||
Here is the stack when clicking on the folder, instead of calling createSubfolder
Host Name: lilblackbk
Date/Time: 2007-12-21 14:00:39.486 -0500
OS Version: 10.4.11 (Build 8S2167)
Report Version: 4
Command: thunderbird-bin
Path: /Users/jminta/mozhack/mozilla/steel-mail-obj/dist/ThunderbirdDebug.app/Contents/MacOS/thunderbird-bin
Parent: launchd [1]
Version: 3.0a1pre (3.0a1pre)
PID: 4433
Thread: 0
Exception: EXC_BAD_ACCESS (0x0001)
Codes: KERN_PROTECTION_FAILURE (0x0002) at 0x00000025
Thread 0 Crashed:
0 libmail.dylib 0x2cd3a6f9 nsMsgDBFolder::NotifyPropertyFlagChanged(nsIMsgDBHdr*, nsIAtom*, unsigned, unsigned) + 183 (nsMsgDBFolder.cpp:4298)
1 libmail.dylib 0x2cdeb901 nsMsgStatusFeedback::OnStateChange(nsIWebProgress*, nsIRequest*, unsigned, unsigned) + 2057 (nsCOMPtr.h:581)
2 libdocshell.dylib 0x13a6d5fb nsDocLoader::FireOnStateChange(nsIWebProgress*, nsIRequest*, int, unsigned) + 685 (nsDocLoader.cpp:1219)
3 libdocshell.dylib 0x13a6e7f9 nsDocLoader::doStopDocumentLoad(nsIRequest*, unsigned) + 207 (nsTString.h:491)
4 libdocshell.dylib 0x13a6fe49 nsDocLoader::DocLoaderIsEmpty() + 777 (nsDocLoader.cpp:765)
5 libdocshell.dylib 0x13a70234 nsDocLoader::OnStopRequest(nsIRequest*, nsISupports*, unsigned) + 880 (nsDocLoader.cpp:679)
6 libnecko.dylib 0x32c38895 nsLoadGroup::RemoveRequest(nsIRequest*, nsISupports*, unsigned) + 977 (nsLoadGroup.cpp:688)
7 libgklayout.dylib 0x15324048 nsDocument::DoUnblockOnload() + 350 (nsCOMPtr.h:581)
8 libgklayout.dylib 0x153240ef nsDocument::UnblockOnload(int) + 123 (nsDocument.cpp:5579)
9 libgklayout.dylib 0x1553c6aa nsBindingManager::DoProcessAttachedQueue() + 534 (nsCOMPtr.h:581)
10 libgklayout.dylib 0x1590194a nsRunnableMethod<nsBindingManager>::Run() + 42 (nsThreadUtils.h:262)
11 libxpcom_core.dylib 0x0132a1ac nsThread::ProcessNextEvent(int, int*) + 646 (nsThread.cpp:511)
12 libxpcom_core.dylib 0x012cc8d0 NS_ProcessPendingEvents_P(nsIThread*, unsigned) + 124 (nsThreadUtils.cpp:180)
13 libwidget_mac.dylib 0x36ed600d 0x36ea0000 + 221197
14 libwidget_mac.dylib 0x36eb8d96 0x36ea0000 + 101782
15 com.apple.CoreFoundation 0x9082cf1a 0x9080b000 + 139034
16 com.apple.CoreFoundation 0x9082ca56 0x9080b000 + 137814
17 com.apple.HIToolbox 0x92de7878 0x92dde000 + 39032
18 com.apple.HIToolbox 0x92de6eb9 0x92dde000 + 36537
19 com.apple.HIToolbox 0x92de6dd9 0x92dde000 + 36313
20 com.apple.AppKit 0x9328d485 0x93276000 + 95365
21 com.apple.AppKit 0x9328d076 0x93276000 + 94326
22 com.apple.AppKit 0x93286dfb 0x93276000 + 69115
23 libwidget_mac.dylib 0x36eb8864 0x36ea0000 + 100452
24 libtoolkitcomps.dylib 0x360d4272 0x360d3000 + 4722
25 XUL 0x00217f81 XRE_main + 28873 (nsAppRunner.cpp:3149)
26 org.mozilla.thunderbird 0x00002c90 main + 598 (nsMailApp.cpp:87)
27 org.mozilla.thunderbird 0x000023c6 _start + 216
28 org.mozilla.thunderbird 0x000022ed start + 41
Comment 2•18 years ago
|
||
As near as I can tell, the problem is that the folder object isn't holding a reference to the listener object, because it's using nsVoidArray, or something like that. It seems like the js xpconnect wrapper object gets deleted if the C++ code doesn't add a ref to it, which causes a crash down the road. If I change nsMsgDBFolder to use an nsCOMArray, the problem goes away. The original reason we didn't hold a reference to the listeners was that we didn't want to introduce cycles. I think the one case where that might have been a problem (the account mgr ds adding itself as a listener to the root folder of every account) isn't a problem since it clears itself as a listener at shutdown. Not sure what happens in the remove account case, however, though a quick code examination makes it look OK.
Comment 3•18 years ago
|
||
The stack trace makes this look like a memory safety bug. Is this something that a malicious email message would be able to exploit, in which case it should be marked as [sg:critical?] and remain hidden until it is fixed? Or does this bug just affect an extension, or something else?
Comment 4•18 years ago
|
||
From a separate IRC conversation, it appears that this code is storing observers in a nsTObserverArray<nsIFolderListener*>. nsTObserverArray does not hold strong references, so this is memory-unsafe (though I have no clue under what conditions an attacker might be able to exploit it).
dwitte,smaug, you've both touched nsTObserverArray... can you explain why it holds raw references and not strong pointers?
Comment 5•18 years ago
|
||
And, assuming this won't cause reference-cycle leaks, the obvious solution is to use nsTObserverArrray<nsCOMPtr<nsIFolderListener> > instead of nsTObserverArray<nsIFolderListener*>
Comment 6•18 years ago
|
||
(In reply to comment #4)
> dwitte,smaug, you've both touched nsTObserverArray... can you explain why it
> holds raw references and not strong pointers?
from memory, i believe there were some consumers that didn't want to use nsCOMPtr with their nsTObserverArray, to avoid unnecessary overhead... especially since they can trivially use an nsCOMPtr<> template argument to get strong refs when they want it. there's also no need for nsTObserverArray to be restricted to classes implementing AddRef and Release.
Updated•18 years ago
|
Product: Core → MailNews Core
Comment 7•17 years ago
|
||
bsmedberg, can you take a stab at assigning a severity rating to this bug per our rating standards:
https://wiki.mozilla.org/Security_Severity_Ratings
Comment 8•17 years ago
|
||
No, sorry, I don't know the mailnews code at all. Please ask a mailnews peer.
Comment 9•17 years ago
|
||
Oh, my mistake. David, would you mind assigning a severity rating to this bug? The stack in comment 0 looks somewhat scary, but we're trying to decide if this is an exploitable crash (which would warrant an sg:critical rating) or not. Thanks.
Comment 10•17 years ago
|
||
As I understand it, this is something an extension might do; the core thunderbird code doesn't do this.
Comment 11•17 years ago
|
||
what severity rating would we assign to a bug that can cause extensions to potentially be exploitable?
Comment 12•17 years ago
|
||
Thanks, David. I'm going to assign sg:critical? for now. Others can feel free to lower the severity if they feel it's overstated.
What is the consensus on the fix suggested by bsmedberg in comment 5? It seems the extra overhead referred to in comment 6 might be justified given that the current state could be exploitable in extension code. Is there someone who can own this?
Whiteboard: [sg:critical?]
Comment 13•17 years ago
|
||
(In reply to comment #10)
> As I understand it, this is something an extension might do; the core
> thunderbird code doesn't do this.
What does Thunderbird do differently? We appear to AddFolderListener() from js
in several places. Although on second look they appear to be called on mail
sessions rather than folders, which does use a nsCOMPtr in there but looks
kinda wonky the way it's doing it: it's copying a stack-allocated struct
containing the comptr into the observer array -- that's not going to addref the
comptr is it?
http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/mailnews/base/src/nsMsgMailSession.cpp&rev=1.92&mark=89,99,100#89
So this is a booby-trapped API, we need to either fix it to use comptrs in the
array or make the unsafe entries unreachable from script. I imagine we can't
remove scriptable on the whole API but we could put [noscript] on
AddFolderListener.
Whiteboard: [sg:critical?] → [sg:moderate] critical hazard for unwary js code
Comment 14•16 years ago
|
||
fwiw, nothing on crash-stats since jan 2009
Severity: normal → critical
Summary: Crash when adding listener to local folder [@nsMsgDBFolder::NotifyItemAdded] → Crash when adding listener to local folder [@nsMsgDBFolder::NotifyItemAdded(nsISupports*)]
Updated•15 years ago
|
Crash Signature: [@nsMsgDBFolder::NotifyItemAdded(nsISupports*)]
Updated•14 years ago
|
Keywords: sec-moderate
Comment 15•14 years ago
|
||
(In reply to Wayne Mery (:wsmwk) from comment #14)
> fwiw, nothing on crash-stats since jan 2009
after multi year hiatus, this crash sig appears again in TB12 - for example bp-e77465c8-8e81-4a38-991d-a38b22120525 - and continues in current releases like bp-c5c99d2c-3634-44d9-ab46-572f32120808 TB15
a common comment is performing UNDO
Crash Signature: [@nsMsgDBFolder::NotifyItemAdded(nsISupports*)] → [@ nsMsgDBFolder::NotifyItemAdded(nsISupports*)]
[@ nsMsgDBFolder::NotifyItemAdded ]
OS: Mac OS X → All
Summary: Crash when adding listener to local folder [@nsMsgDBFolder::NotifyItemAdded(nsISupports*)] → Crash when adding listener to local folder [@ nsMsgDBFolder::NotifyItemAdded(nsISupports*)]
Comment 16•13 years ago
|
||
who is currently operating in the area of comment 14 that could address this?
Is addon dev doc/posting needed even if this gets fixed?
bug 380167 is related?
current crash example: bp-de2d9402-9dbc-40dd-b4ee-cf5922130819
0 XUL nsMsgDBFolder::NotifyItemAdded mailnews/base/util/nsMsgDBFolder.cpp
1 XUL nsMsgThreadedDBView::OnNewHeader mailnews/base/src/nsMsgThreadedDBView.cpp
2 XUL nsMsgDatabase::NotifyHdrAddedAll mailnews/db/msgdb/src/nsMsgDatabase.cpp
3 XUL nsMsgDatabase::AddNewHdrToDB mailnews/db/msgdb/src/nsMsgDatabase.cpp
4 XUL nsMsgLocalMailFolder::EndCopy mailnews/local/src/nsLocalMailFolder.cpp
5 XUL morkAtomSpace::MakeBookAtomCopy db/mork/src/morkAtomSpace.cpp
Crash Signature: [@ nsMsgDBFolder::NotifyItemAdded(nsISupports*)]
[@ nsMsgDBFolder::NotifyItemAdded ] → [@ nsMsgDBFolder::NotifyItemAdded(nsISupports*)]
[@ nsMsgDBFolder::NotifyItemAdded]
Flags: needinfo?
Comment 17•13 years ago
|
||
Luckily there is only one place of the risk of circular reference. It is in nsMsgSendLater.
This patch changes nsCOMPtr<nsIMsgFolder> to nsWeakPtr in nsMsgSendLater, and nsTObserverArray<nsIFolderListener*> to nsTObserverArray<nsCOMPtr<nsIFolderListener> >.
Attachment #806517 -
Flags: review?(mbanner)
Flags: needinfo?
Comment 18•13 years ago
|
||
Comment on attachment 806517 [details] [diff] [review]
Hold a reference to the listener
Review of attachment 806517 [details] [diff] [review]:
-----------------------------------------------------------------
This looks fine to me, though given the area it is touching, I'd like Neil to take a look as well.
Attachment #806517 -
Flags: review?(neil)
Attachment #806517 -
Flags: review?(mbanner)
Attachment #806517 -
Flags: review+
Comment 19•13 years ago
|
||
Comment on attachment 806517 [details] [diff] [review]
Hold a reference to the listener
> // This can't be refcounted due to ownsership issues
>- nsTObserverArray<nsIFolderListener*> mListeners;
>+ nsTObserverArray<nsCOMPtr<nsIFolderListener> > mListeners;
Nit: remove out-of-date comment
>+ mMessageFolder = do_GetWeakReference(folder);
>+ if (!mMessageFolder)
>+ return NS_ERROR_FAILURE;
>+
> // XXX may want to send messages X seconds after startup if there are any.
>
> return NS_OK;
mMessageFolder = do_GetWeakReference(folder, &rv);
return rv;
> if (mMessageFolder)
> {
>- rv = mMessageFolder->RemoveFolderListener(this);
>+ nsCOMPtr<nsIMsgFolder> folder = do_QueryReferent(mMessageFolder, &rv);
>+ NS_ENSURE_SUCCESS(rv, rv);
>+ rv = folder->RemoveFolderListener(this);
> NS_ENSURE_SUCCESS(rv, rv);
> }
Lack of a weak reference during shutdown is probably the point, not an error:
nsCOMPtr<nsIMsgFolder> folder = do_QueryReferent(mMessageFolder);
if (folder)
{
rv = folder->RemoveFolderListener(this);
NS_ENSURE_SUCCESS(rv, rv);
}
> // XXX This code should be set up for multiple unsent folders, however we
> // don't support that at the moment, so for now just assume one folder.
> if (!mMessageFolder)
> {
>+ nsCOMPtr<nsIMsgFolder> folder;
> rv = GetUnsentMessagesFolder(nullptr,
>+ getter_AddRefs(folder));
> NS_ENSURE_SUCCESS(rv, rv);
>+ mMessageFolder = do_GetWeakReference(folder);
>+ if (!mMessageFolder)
>+ return NS_ERROR_FAILURE;
> }
> rv = ReparseDBIfNeeded(nullptr);
> NS_ENSURE_SUCCESS(rv, rv);
>
> int32_t totalMessages;
>+ nsCOMPtr<nsIMsgFolder> folder = do_QueryReferent(mMessageFolder, &rv);
>+ NS_ENSURE_SUCCESS(rv, rv);
I am not sure that this is safe; when you drop the strong reference to folder, you might lose the object and your weak reference fails. Or indeed you might have fetched the weak reference earlier and the object has since gone away. Instead I would improve GetUnsentMessagesFolder to try getting the weak reference from mMessageFolder first, and then consistently use GetUnsentMessagesFolder everywhere. Pseudocode:
function GetUnsentMessagesFolder(aRetval)
{
var folder = do_QueryReferent(mMessageFolder);
if (!folder) {
folder = LocateMessageFolder(GetFolderURIFromUserPrefs());
mMessageFolder = do_GetWeakReference(folder);
}
folder.forget(aRetval);
}
r- based on the apparently unsafe weak reference usage. If Mark thinks that the folder object will be held alive until shutdown for other reasons then this may actually be safe in which case r+ with the other three nits fixed.
Attachment #806517 -
Flags: review?(neil) → review-
Updated•12 years ago
|
Group: mail-core-security
Updated•12 years ago
|
Group: mail-core-security
Comment 20•11 years ago
|
||
(In reply to neil@parkwaycc.co.uk from comment #19)
> Comment on attachment 806517 [details] [diff] [review]
> Hold a reference to the listener
>...
> r- based on the apparently unsafe weak reference usage. If Mark thinks that
> the folder object will be held alive until shutdown for other reasons then
> this may actually be safe in which case r+ with the other three nits fixed.
Mark what are your thoughts on this?
Flags: needinfo?(standard8)
Comment 21•11 years ago
|
||
(In reply to Wayne Mery (:wsmwk) from comment #20)
> (In reply to neil@parkwaycc.co.uk from comment #19)
> > Comment on attachment 806517 [details] [diff] [review]
> > Hold a reference to the listener
> >...
> > r- based on the apparently unsafe weak reference usage. If Mark thinks that
> > the folder object will be held alive until shutdown for other reasons then
> > this may actually be safe in which case r+ with the other three nits fixed.
>
> Mark what are your thoughts on this?
Unfortunately its too long since I had my head in the code to be sure about this. I think we do generally release folder objects, but I could be wrong. It'd need analysis of the existing code, especially round some of the folder management areas.
Flags: needinfo?(standard8)
Updated•11 years ago
|
Group: core-security → mail-core-security
Comment 22•11 years ago
|
||
Removing myslef on all the bugs I'm cced on. Please NI me if you need something on MailNews Core bugs from me.
Updated•9 years ago
|
Blocks: 380167
Whiteboard: [sg:moderate] critical hazard for unwary js code → [sg:moderate][critical hazard for unwary js code][patchlove]
Comment 23•8 years ago
|
||
I imagine this is still alive, at least bug 873426 has recent crashes. If it's the same.
Comment 24•8 years ago
|
||
Here's an updated patch with the comments addressed. I'm not sure who should review this, so I'll leave that up to you, Magnus.
Flags: needinfo?(mkmelin+mozilla)
Comment 25•8 years ago
|
||
Comment on attachment 9005102 [details] [diff] [review]
409458-folder-listener-1.diff
Review of attachment 9005102 [details] [diff] [review]:
-----------------------------------------------------------------
Hoping Jörg can make sense of it.
Attachment #9005102 -
Flags: review?(jorgk)
Updated•8 years ago
|
Flags: needinfo?(mkmelin+mozilla)
| Assignee | ||
Comment 26•8 years ago
|
||
Sorry about the delay. Something to look at on a relaxed Sunday evening ;-)
Looks like there was a previous try run
https://treeherder.mozilla.org/#/jobs?repo=try-comm-central&revision=76410d27145a103b2abcc9b9f966e7ea1b66efb7
but let's have a new one since Linux is working again:
https://treeherder.mozilla.org/#/jobs?repo=try-comm-central&revision=dae737884e0a05d352766fc238df37d1baf10014
Better safe than sorry.
The reason for the r- from the end of comment #19 was not addressed. Neil requested something like
function GetUnsentMessagesFolder(aRetval)
{
var folder = do_QueryReferent(mMessageFolder);
if (!folder) {
folder = LocateMessageFolder(GetFolderURIFromUserPrefs());
mMessageFolder = do_GetWeakReference(folder);
}
folder.forget(aRetval);
}
which the comment that the folder object may disappear which was (sort of) confirmed in comment #21.
Geoff, did you look into that issue further? Should we give that approach a shot?
| Assignee | ||
Comment 27•8 years ago
|
||
Aceman has been involved in folder caching and clean-up, so maybe he has an opinion here. Since this bug is pretty ancient (11 y/o), another couple of days won't make a great difference now.
Flags: needinfo?(acelists)
| Assignee | ||
Comment 28•8 years ago
|
||
Comment on attachment 9005102 [details] [diff] [review]
409458-folder-listener-1.diff
Review of attachment 9005102 [details] [diff] [review]:
-----------------------------------------------------------------
Terribly sorry, ignore comment #26. Neil's comment #19 was fully, well, almost fully, implemented.
Just one more question.
::: mailnews/compose/src/nsMsgSendLater.cpp
@@ +127,3 @@
> NS_ENSURE_SUCCESS(rv, rv);
>
> + mMessageFolder = do_GetWeakReference(folder, &rv);
Move this into GetUnsentMessagesFolder()?
@@ +671,5 @@
> + nsCOMPtr<nsIMsgFolder> folder = do_QueryReferent(mMessageFolder);
> + if (!folder) {
> + nsCString uri;
> + GetFolderURIFromUserPrefs(nsIMsgSend::nsMsgQueueForLater, aIdentity, uri);
> + rv = LocateMessageFolder(aIdentity, nsIMsgSend::nsMsgQueueForLater, uri.get(), getter_AddRefs(folder));
Add mMessageFolder = do_GetWeakReference(folder); here as Neil suggested?
@@ +710,3 @@
> return NS_OK;
> +
> + mMessageFolder = do_GetWeakReference(folder);
Move this into GetUnsentMessagesFolder()?
| Assignee | ||
Updated•8 years ago
|
Flags: needinfo?(acelists)
| Assignee | ||
Comment 29•8 years ago
|
||
Documentation isn't great, but reading the IDL helps:
https://dxr.mozilla.org/mozilla-central/source/xpcom/base/nsIWeakReference.idl
| Assignee | ||
Comment 30•8 years ago
|
||
Comment on attachment 9005102 [details] [diff] [review]
409458-folder-listener-1.diff
Haha, try failed since it's MailServices.jsm now. Also, we use ChromeUtils.import now.
I'll attach my suggestion with a new try in a moment.
Attachment #9005102 -
Flags: review?(jorgk)
| Assignee | ||
Comment 31•8 years ago
|
||
I moved the lines in question.
Any objection to this? Maybe the try has:
https://treeherder.mozilla.org/#/jobs?repo=try-comm-central&revision=cf924dfa66cb4054a38083183c17963d79dc5f07
Assignee: nobody → jorgk
Attachment #9007627 -
Flags: feedback?(geoff)
Comment 32•8 years ago
|
||
Comment on attachment 9007627 [details] [diff] [review]
409458-folder-listener-1.diff (JK)
Review of attachment 9007627 [details] [diff] [review]:
-----------------------------------------------------------------
LGTM, apart from the comment below.
::: mailnews/compose/src/nsMsgSendLater.cpp
@@ +792,1 @@
> NS_ENSURE_SUCCESS(rv, rv);
We checked for NS_FAILED(rv) || !folder in the other places, does that need to happen here?
Attachment #9007627 -
Flags: feedback?(geoff) → feedback+
| Assignee | ||
Comment 33•8 years ago
|
||
Comment on attachment 9007627 [details] [diff] [review]
409458-folder-listener-1.diff (JK)
Review of attachment 9007627 [details] [diff] [review]:
-----------------------------------------------------------------
::: mailnews/compose/src/nsMsgSendLater.cpp
@@ +792,1 @@
> NS_ENSURE_SUCCESS(rv, rv);
The other two callsites have the comment:
// There doesn't have to be a nsMsgQueueForLater flagged folder.
So they explicitly ignore the fact that it doesn't exist.
This code here is in InternalSendMessages(), so we're already sending messages.
But I can see your point, I'll add it.
| Assignee | ||
Comment 34•8 years ago
|
||
Please use interdiff.
Attachment #806517 -
Attachment is obsolete: true
Attachment #9005102 -
Attachment is obsolete: true
Attachment #9007627 -
Attachment is obsolete: true
Attachment #9007703 -
Flags: review+
Attachment #9007703 -
Flags: feedback?(geoff)
Updated•8 years ago
|
Attachment #9007703 -
Flags: feedback?(geoff) → feedback+
| Assignee | ||
Comment 35•8 years ago
|
||
https://hg.mozilla.org/comm-central/rev/2cfa24cfd1ac6984457e9bd952fb2e347670faba
nsIMsgFolder.AddFolderListener should hold a reference to the listener. r=standard8,neil,darktrojan,jorgk
Fixed after 11 years, four reviewers.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 64.0
Updated•8 years ago
|
Group: mail-core-security → core-security-release
Comment 37•8 years ago
|
||
Jorg, thanks for the patch.
An observation - the crash rate so far for version 60 (only 1.6% of crashes) is much lower than 52.x [1]. Perhaps it is because of fewer addons running on v60. The only user we have is Adam from bug 873426 (if he's even still around), We'll need to check in 3-4 weeks after automatic updates have moved more users, and also check beta stats because there are a few crashes per week for beta.
A little troubling, is the crash data shows *many* users not on the most recent versions of 52.x. So will also need to dive into what is causing that. More generally, perhaps a high percentage are on OS not supported in version 60.
Thunderbird 52.9.1 529 39.0% 477
Thunderbird 52.8.0 303 22.3% 578
Thunderbird 52.7.0 283 20.9% 191
Thunderbird 45.8.0 67 4.9% 56
Thunderbird 52.9.0 30 2.2% 34
Thunderbird 52.4.0 26 1.9% 28
Thunderbird 60.0 22 1.6% 16
Thunderbird 52.6.0 19 1.4% 20
[1] two weeks data - https://crash-stats.mozilla.com/signature/?signature=nsMsgDBFolder%3A%3ANotifyItemAdded&date=%3E%3D2018-04-14T04%3A21%3A56.000Z&date=%3C2018-10-14T04%3A21%3A56.000Z#summary
Crash Signature: [@ nsMsgDBFolder::NotifyItemAdded(nsISupports*)]
[@ nsMsgDBFolder::NotifyItemAdded] → [@ nsMsgDBFolder::NotifyItemAdded ]
Summary: Crash when adding listener to local folder [@ nsMsgDBFolder::NotifyItemAdded(nsISupports*)] → Crash when adding listener to local folder [@ nsMsgDBFolder::NotifyItemAdded]
Whiteboard: [sg:moderate][critical hazard for unwary js code][patchlove] → [sg:moderate][critical hazard for unwary js code]
Comment 38•7 years ago
|
||
Jorg, how do you feel about the risk for uplifting this to 60.3?
I don't think we have any odd reports on 64 beta with this running for about a month, but the TB64 crash rate is too low to say it has helped crashes. So to determine effecacy in the wild we will want to uplift at some point - we can do it now, or have it bake further until January in beta 65 if you think that is the prudent choice.
But if we are going to uplift before xmas I'd rather see it in 60.3.2 than 60.4.0.
> An observation - the crash rate so far for version 60 (only 1.6% of crashes) is much lower than 52.x [1].
Looking at newer data with version 60 I'd say the crash rate hasn't changed compared to version 52 :(
https://crash-stats.mozilla.com/signature/?signature=nsMsgDBFolder%3A%3ANotifyItemAdded&date=%3E%3D2018-11-10T19%3A59%3A54.000Z&date=%3C2018-11-24T19%3A59%3A54.000Z
Crash Signature: [@ nsMsgDBFolder::NotifyItemAdded ] → [@ nsMsgDBFolder::NotifyItemAdded]
status-thunderbird64:
--- → fixed
status-thunderbird_esr60:
--- → affected
Flags: needinfo?(jorgk)
| Assignee | ||
Comment 39•7 years ago
|
||
Comment on attachment 9007703 [details] [diff] [review]
409458-folder-listener-1.diff (JK, v2)
Let's do it!
Flags: needinfo?(jorgk)
Attachment #9007703 -
Flags: approval-comm-esr60+
| Assignee | ||
Comment 40•7 years ago
|
||
| Assignee | ||
Comment 41•7 years ago
|
||
https://hg.mozilla.org/releases/comm-esr60/rev/ef701c1534bfe8a22705b77f9f517f00abd795ac
fix backport error: mailServices.js vs. MailServices.jsm. rs=bustage-fix a=jorgk
Comment 42•7 years ago
|
||
This crash signature is gone in 60.3.2 and 60.3.3
Updated•6 years ago
|
Group: core-security-release
You need to log in
before you can comment on or make changes to this bug.
Description
•