Closed
Bug 1239873
Opened 9 years ago
Closed 9 years ago
Fix fragile shutdown of MediaStreamGraph using AsyncShutdown
Categories
(Core :: Audio/Video: MediaStreamGraph, defect, P1)
Core
Audio/Video: MediaStreamGraph
Tracking
()
RESOLVED
FIXED
mozilla46
Tracking | Status | |
---|---|---|
firefox46 | --- | fixed |
People
(Reporter: jib, Assigned: jib)
References
Details
Attachments
(2 files, 1 obsolete file)
From bug 1235968 comment 14: rework the shutdown code for MediaStreamGraph -- much like for MediaManager (using AsyncShutdown).
Updated•9 years ago
|
Updated•9 years ago
|
Updated•9 years ago
|
Rank: 10
Priority: -- → P1
Updated•9 years ago
|
Assignee: nobody → jib
Assignee | ||
Comment 1•9 years ago
|
||
Review commit: https://reviewboard.mozilla.org/r/31889/diff/#index_header See other reviews: https://reviewboard.mozilla.org/r/31889/
Attachment #8710865 -
Flags: review?(rjesup)
Assignee | ||
Comment 2•9 years ago
|
||
Note that I couldn’t block past the final LIFECYCLE_WAITING_FOR_STREAM_DESTRUCTION stage, since completion of that stage seems to require shutdown to proceed.
Assignee | ||
Comment 3•9 years ago
|
||
Comment on attachment 8710865 [details] MozReview Request: Bug 1239873 - Use AsyncShutdown API to shut down MediaStreamGraph thread. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/31889/diff/1-2/
Assignee | ||
Comment 4•9 years ago
|
||
Rebase. try seems to have crapped up?
Assignee | ||
Comment 5•9 years ago
|
||
Try is *almost* perma-orange. More to do.
Updated•9 years ago
|
Attachment #8710865 -
Flags: review?(rjesup)
Comment 6•9 years ago
|
||
Comment on attachment 8710865 [details] MozReview Request: Bug 1239873 - Use AsyncShutdown API to shut down MediaStreamGraph thread. https://reviewboard.mozilla.org/r/31889/#review28685 Overall looks good; a few questions and one real (I think) issue ::: dom/media/MediaStreamGraph.cpp:1356 (Diff revision 2) > + gMediaStreamGraphShutdownBlocker = nullptr; So I'm wondering... I think MediaStreamGraphShutDownRunnables exist for *each* extant graph, so don't we want to remove the blocker only when all of the ones we marked for mForceShutdown have actually shut down, not just one of them? ::: dom/media/MediaStreamGraph.cpp:1359 (Diff revision 2) > + // stage, since completion of that stage requires shutdown to proceed. Elaborate on this (I presume other things not yet shut down are holding streams still) ::: dom/media/MediaStreamGraph.cpp:2728 (Diff revision 2) > + { Should we assert MainThread here? Or is it well-guaranteed for ShutdownBlocker? (Likely we don't need to assert it.)
Assignee | ||
Comment 7•9 years ago
|
||
https://reviewboard.mozilla.org/r/31889/#review28703 ::: dom/media/MediaStreamGraph.cpp:1356 (Diff revision 2) > + gMediaStreamGraphShutdownBlocker = nullptr; Yes, and I also need to handle when there are zero open graphs at shutdown (i.e. remove blocker), which seems to be what's biting me on try. Tip: you can drag-highlight several lines in mozReview. ;) ::: dom/media/MediaStreamGraph.cpp:1359 (Diff revision 2) > + // stage, since completion of that stage requires shutdown to proceed. I presume so as well. Here's what I observed in an earlier version where I held the blocker all the way till MediaStreamGraph::Destroy(): > 2016-01-22 03:34:14.810041 UTC - [0x116873070]: D/MediaStreamGraph MediaStreamGraph 1731e6500 ForceShutdown > 2016-01-22 03:34:14.810212 UTC - [0x17526fb30]: V/MediaStreamGraph MediaStream 172f44d00 bufferStartTime=0.043537 blockedTime=0.031927 > 2016-01-22 03:34:14.810240 UTC - [0x17526fb30]: D/MediaStreamGraph MediaStreamGraph 1731e6500 waiting for main thread cleanup > 2016-01-22 03:34:14.843263 UTC - [0x116873070]: D/MediaStreamGraph Stopping threads for MediaStreamGraph 172de11c0 > 2016-01-22 03:34:22.345408 UTC - [0x116873070]: D/MediaStreamGraph Removing media stream 0 from the graph > 2016-01-22 03:34:22.345432 UTC - [0x116873070]: D/MediaStreamGraph Removing media stream 0 from the graph > 2016-01-22 03:34:22.345444 UTC - [0x116873070]: D/MediaStreamGraph Removing media stream 0 from the graph > 2016-01-22 03:34:22.347174 UTC - [0x116873070]: D/MediaStreamGraph MediaStreamGraph 1731e6500 destroyed I believe the ~8 idle seconds after "Stopping threads for MediaStreamGraph" is the AsyncShutdown blocker timing out after 10 seconds. Streams seem held up by other stuff. ::: dom/media/MediaStreamGraph.cpp:2728 (Diff revision 2) > + { Seems well-guaranteed by API.
Assignee | ||
Comment 8•9 years ago
|
||
Comment on attachment 8710865 [details] MozReview Request: Bug 1239873 - Use AsyncShutdown API to shut down MediaStreamGraph thread. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/31889/diff/2-3/
Attachment #8710865 -
Flags: review?(rjesup)
Assignee | ||
Comment 9•9 years ago
|
||
Would ideally like another pass to clean this up a bit, but seems green on try, so I'm putting it up.
Comment 10•9 years ago
|
||
Comment on attachment 8710865 [details] MozReview Request: Bug 1239873 - Use AsyncShutdown API to shut down MediaStreamGraph thread. https://reviewboard.mozilla.org/r/31889/#review28799 ::: dom/media/MediaStreamGraph.cpp:1455 (Diff revisions 2 - 3) > - } > + // which requires shutdown to proceed. Should we re-block at a later stage? This might be tricky, since some streams might continue to exist until the final CC pass, perhaps - which is after xpcom-shutdown-threads. We have shut down the driver threads, however, so this should be ok. ::: dom/media/MediaStreamGraph.cpp:2834 (Diff revisions 2 - 3) > - MediaStreamGraphImpl* graph = iter.UserData(); > + iter.UserData()->ForceShutDown(ticket); This looks good!
Attachment #8710865 -
Flags: review?(rjesup) → review+
Assignee | ||
Comment 11•9 years ago
|
||
(In reply to Randell Jesup [:jesup] from comment #10) > Should we re-block at a later stage? That's definitely something we could look at as a followup, though I suspect you're right that we'd need to wait until final GC, which doesn't seem doable. Try looks green and almost complete, I also have a green try from yesterday.
Comment 13•9 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/f31612f8f3bb
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla46
Assignee | ||
Updated•8 years ago
|
Comment 16•8 years ago
|
||
MozReview-Commit-ID: J39kgU76VwL
Updated•8 years ago
|
Assignee: jib → rjesup
Comment 17•8 years ago
|
||
Comment on attachment 8755520 [details] [diff] [review] Backout f31612f8f3bb () from beta 47 wrong bug...
Attachment #8755520 -
Attachment is obsolete: true
Updated•8 years ago
|
Assignee: rjesup → jib
Comment 18•8 years ago
|
||
We've made progress on this (two patches, fixing a lot of intermittents and probably shutdown crashes in the wild as well), but we're not quite ready yet, best to back it out again.
Attachment #8763606 -
Flags: review?(jib)
Updated•8 years ago
|
Assignee: jib → padenot
Assignee | ||
Updated•8 years ago
|
Attachment #8763606 -
Flags: review?(jib) → review+
Updated•8 years ago
|
Assignee: padenot → jib
You need to log in
before you can comment on or make changes to this bug.
Description
•