Open
Bug 1498508
Opened 7 years ago
Updated 3 years ago
Avoid initiating DOM Cache IPC when worker is shutting down
Categories
(Core :: DOM: Service Workers, enhancement, P3)
Core
DOM: Service Workers
Tracking
()
NEW
Tracking | Status | |
---|---|---|
firefox64 | --- | affected |
People
(Reporter: ytausky, Unassigned)
Details
The cause for bug 1484524 was that a service worker tried to initiate IPC after it started shutting down. Due to the shutdown it couldn't get a StrongWorkerRef to its WorkerPrivate and the resulting nullptr made it into the IPC glue code, where it triggered an assertion.
That bug was mitigated with a fairly blunt nullptr check, but a more reliable solution is necessary. Preferably it would require calling code to provide a StrongWorkerRef to initiate IPC, thus moving failure detection to the caller.
![]() |
Reporter | |
Comment 1•7 years ago
|
||
One problem with the current situation is that StrongWorkerRefs are readily available through a globally accessible function[1], so it's not clear at the point of usage[2] whether a function requires such a reference. This, in turn, makes it hard to know where to check for errors. Also, some functions along the call stack crash on failure[3], thus discouraging other functions from returning an error code. In the end, the caller neither knows it has to check for preconditions nor has a decent chance to check the postconditions.
I think a good, local[-ish] mitigation would be to require the reference be propagated through the call stack. That's a problem though, because nsIInputStream can be embedded in IPC messages, and its serializer[4] (which uses AutoIPCStream) can't be made to take additional parameters. I think IPCStream doesn't do anything risky in its serializer, so my next step would be to try to lift the reference acquisition out of AutoIPCStream. That would preserve the existing behavior for users of nsIInputStream while improving the situation for users of IPCStream.
[1] https://searchfox.org/mozilla-central/source/dom/workers/WorkerRef.cpp#177
[2] https://searchfox.org/mozilla-central/source/dom/cache/Cache.cpp#446
[3] https://searchfox.org/mozilla-central/source/ipc/glue/IPCStreamUtils.cpp#524
[4] https://searchfox.org/mozilla-central/source/ipc/glue/IPCStreamUtils.cpp#640
Updated•6 years ago
|
Assignee: ytausky → perry
Updated•6 years ago
|
Assignee: perry → nobody
Status: ASSIGNED → NEW
Priority: P2 → P3
Updated•3 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•