Closed Bug 1311275 Opened 8 years ago Closed 8 years ago

Assertion failed in mozilla::net::nsIOService::GetCachedProtocolHandler

Categories

(Core :: Networking, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla52
Tracking Status
firefox52 --- fixed

People

(Reporter: xeonchen, Assigned: xeonchen)

References

Details

(Whiteboard: [proxy][necko-active])

Attachments

(2 files)

Attached file backtrace
Bug 1308275 breaks the assertion |NS_IsMainThread()| in |nsIOService::GetCachedProtocolHandler|
Instead of using NS_GetFileFromURLSpec you will have to decompose that function similar way as I did that in bug 1293327 (your are cc'ed now).  

You simply need to get the file protocol directly (do_GetService) and call the GetFileFromURLSpec on it.  The goal is to not use the 'cached protocol' path, which is not thread safe.

That's all.
You can also cache the protocol yourself if that would be used too often (do_GetService is relatively slow).
Another way to fix this would be to change nsIOService::GetCachedProtocolHandler() to be thread safe (but I assume that option was already considered).

For developers, is there a way to know which functions are thread safe? In other words, how could I have known in advance that NS_GetFileFromURLSpec() is not thread safe?
Attachment #8802790 - Flags: review?(honzab.moz) → review+
Pushed by cbook@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/ee15d36745a8
use protocol service directly instead of NS_GetFileFromURLSpec; r=mayhemer
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/ee15d36745a8
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla52
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: