Closed
Bug 1445681
Opened 6 years ago
Closed 6 years ago
EventSource can fail the shutting down when used in a terminating worker
Categories
(Core :: DOM: Core & HTML, enhancement)
Tracking
()
RESOLVED
FIXED
mozilla61
Tracking | Status | |
---|---|---|
firefox61 | --- | fixed |
People
(Reporter: baku, Assigned: baku)
Details
Attachments
(1 file)
947 bytes,
patch
|
smaug
:
review+
|
Details | Diff | Splinter Review |
When the Web Worker goes away, EventSource holder is notified: https://searchfox.org/mozilla-central/source/dom/base/EventSource.cpp#1795,1799 At this point, we dispatch a runnable to call CloseInternal: https://searchfox.org/mozilla-central/source/dom/base/EventSource.cpp#394-399 This line: MOZ_ASSERT(NS_SUCCEEDED(rv)); is wrong, because we end up using a normal WorkerRunnable and that will not be executed during the shutdown.
Assignee | ||
Comment 1•6 years ago
|
||
I don't think we need this async step to call CloseInternal. There is not a DOM Event dispatched as the comment says. We can directly call CloseInternal. I hope I'm not wrong. I also checked the spec and my approach seems correct.
Attachment #8958874 -
Flags: review?(bugs)
Comment 2•6 years ago
|
||
Isn't the comment about some event listener calling close(). But I still don't quite see why the code is there. Bug 1267903 doesn't really explain it.
Comment 3•6 years ago
|
||
But this code looks very racy.
Comment 4•6 years ago
|
||
IsClosed() check in particular. Since it can be called without holding the lock, even if it returns false, the state may have changed to true already when it returns.
Comment 5•6 years ago
|
||
Comment on attachment 8958874 [details] [diff] [review] eventSource.patch However as far as I see, this as such should be fine. But could you take a look at the implementation a bit. I'm worried about IsClosed() handling. I think that method should take MutexAutoLock& as a param as a gaurantee that caller has lock.
Attachment #8958874 -
Flags: review?(bugs) → review+
Pushed by amarchesini@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/6b12a2c571c9 EventSource::close must do a sync call to CloseInternal, r=smaug
Comment 7•6 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/6b12a2c571c9
Status: NEW → RESOLVED
Closed: 6 years ago
status-firefox61:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla61
Updated•5 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•