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

RESOLVED FIXED in Firefox 52

Status

()

defect
RESOLVED FIXED
3 years ago
3 years ago

People

(Reporter: xeonchen, Assigned: xeonchen)

Tracking

unspecified
mozilla52
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox52 fixed)

Details

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

Attachments

(2 attachments)

Posted 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: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla52
You need to log in before you can comment on or make changes to this bug.