Closed
Bug 620194
Opened 14 years ago
Closed 14 years ago
"ASSERTION: nsLoadGroup not thread-safe" under nsWyciwygCloseEvent::~nsWyciwygCloseEvent
Categories
(Core :: Networking, defect)
Tracking
()
RESOLVED
FIXED
mozilla2.0b9
Tracking | Status | |
---|---|---|
blocking2.0 | --- | final+ |
People
(Reporter: jruderman, Assigned: michal)
References
Details
(Keywords: assertion, regression)
Attachments
(2 files)
3.43 KB,
text/plain
|
Details | |
2.78 KB,
patch
|
bzbarsky
:
review+
|
Details | Diff | Splinter Review |
Seen several times during fuzzing on Linux. I have stacks but no steps to reproduce.
###!!! ASSERTION: nsLoadGroup not thread-safe: '_mOwningThread.GetThread() == PR_GetCurrentThread()', file netwerk/base/src/nsLoadGroup.cpp, line 204
###!!! ASSERTION: nsSimpleURI not thread-safe: '_mOwningThread.GetThread() == PR_GetCurrentThread()', file netwerk/base/src/nsSimpleURI.cpp, line 77
Comment 1•14 years ago
|
||
Is this happening at shutdown? I can see this happening if the NS_DispatchToMainThread in ~nsWyciwygAsyncEvent fails: note that all the callstacks show the runnable method being destroyed there under the nsCOMPtr destructor.
Looks like a regression from bug 599127.
Blocks: 599127
blocking2.0: --- → ?
Comment 3•14 years ago
|
||
Sounds like we should leak the channel rather than doing a wrong-thread release, in that situation. :( We have to do that a few other places in necko too. :(
Assignee | ||
Comment 4•14 years ago
|
||
We shutdown the cache IO thread in nsCacheService::Shutdown() which happens on "xpcom-shutdown". It should be possible to post events to the main thread until this point, right? So is there any reason why NS_DispatchToMainThread could fail?
// ensure we free our ref before event gets released on main thread
mChannel = 0;
NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
We release the reference that is hold by mChannel, but event references the channel too. So is it still possible that the event is dispatched and processed on the main thread while we hold the reference on the background thread? If yes then this concept with MainReleaseNoOp() can't work reliably and we need to find another mechanism to ensure releasing the WyciwygChannel on the main thread.
The other option is to make nsLoadGroup and nsSimpleURI threadsafe.
Reporter | ||
Comment 5•14 years ago
|
||
> The other option is to make nsLoadGroup and nsSimpleURI threadsafe.
In some of my logs for this bug, there are thread-safety warnings for ~5 additional classes.
Comment 6•14 years ago
|
||
> So is it still possible that the event is dispatched and processed
> on the main thread while we hold the reference on the background thread?
Oh, hmm. Yes, it's possible, I suppose; if we post the event and then lose our timeslice and then it runs.
So yes, I think this code is just broken. Is there a reason you're reinventing NS_ProxyRelease here, btw?
Comment 7•14 years ago
|
||
> The other option is to make nsLoadGroup and nsSimpleURI threadsafe.
I don't think that's an option, fwiw. The channel can entrain lots of other non-threadsafe stuff too; we should just proxy the release to the main thread correctly and be done with it.
Assignee | ||
Comment 8•14 years ago
|
||
(In reply to comment #6)
> So yes, I think this code is just broken. Is there a reason you're reinventing
> NS_ProxyRelease here, btw?
There is no reason to not use NS_ProxyRelease. Attached patch fixes it.
Attachment #499418 -
Flags: review?(bzbarsky)
Comment 9•14 years ago
|
||
Comment on attachment 499418 [details] [diff] [review]
fix
r=me
Attachment #499418 -
Flags: review?(bzbarsky) → review+
Assignee | ||
Comment 10•14 years ago
|
||
Does this change need superreview?
Comment 11•14 years ago
|
||
imo, no.
Assignee | ||
Updated•14 years ago
|
Keywords: checkin-needed
Comment 12•14 years ago
|
||
Needs approval or blocking state to land.
Assignee: nobody → michal.novotny
Keywords: checkin-needed
Updated•14 years ago
|
blocking2.0: ? → final+
Keywords: checkin-needed
Comment 13•14 years ago
|
||
Status: NEW → RESOLVED
Closed: 14 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → mozilla2.0b9
You need to log in
before you can comment on or make changes to this bug.
Description
•