Closed
Bug 1072780
Opened 9 years ago
Closed 9 years ago
MediaStreamGraph cleanup from refactor
Categories
(Core :: WebRTC: Audio/Video, defect)
Tracking
()
RESOLVED
FIXED
mozilla35
Tracking | Status | |
---|---|---|
firefox32 | --- | unaffected |
firefox33 | --- | unaffected |
firefox34 | --- | fixed |
firefox35 | --- | fixed |
b2g-v2.1 | --- | fixed |
b2g-v2.2 | --- | fixed |
People
(Reporter: jesup, Assigned: jesup)
References
Details
(Whiteboard: [webrtc-uplift])
Attachments
(3 files, 3 obsolete files)
8.25 KB,
patch
|
roc
:
review+
lmandel
:
approval-mozilla-aurora+
|
Details | Diff | Splinter Review |
3.95 KB,
patch
|
roc
:
review+
lmandel
:
approval-mozilla-aurora+
|
Details | Diff | Splinter Review |
15.61 KB,
patch
|
roc
:
review+
lmandel
:
approval-mozilla-aurora+
|
Details | Diff | Splinter Review |
Bug 848954 refactored MediaStreamGraph and introduced GraphDriver; we need to land a number of cleanups for intermittents and race conditions. CurrentDriver() from off-MSG-thread is a common problem. Also found that mInCallback was getting set and cleared immediately due to how the DebugOnly was set up. First patch here should underly bug 1072775 since it depends on InCallback()
Assignee | ||
Comment 1•9 years ago
|
||
Assignee | ||
Comment 2•9 years ago
|
||
patch 2 is bug 1072775 currently - this is all WIP
Assignee | ||
Comment 3•9 years ago
|
||
Comment on attachment 8495053 [details] [diff] [review] patch 3 - Use atomics for EnsureNextIteration to close races around CurrentDriver roc - feedback appreciated at trying to streamline and make EnsureNextIteration safe without heavy locks (now that drivers can change under us and also sleep). Implements roughly this: [01:26] jesup considered an Atomic<bool> for EnsureNextIteration to avoid the need for CurrentDriver(), but the need to do a WakeUp() if the driver is asleep made that unappealing for now [01:30] jesup Though I imagine something like "(atomic) mOneMoreIteration = true; if ((atomic) mIsAsleep) { MonitorAutoLock lock(mMonitor); CurrentDriver()->WakeUp; }" might work. Any races remaining are just un-needed WakeUps
Attachment #8495053 -
Flags: feedback?(roc)
Assignee | ||
Comment 4•9 years ago
|
||
https://tbpl.mozilla.org/?tree=Try&rev=c709d5e64095 with both plus bug 1072775 and bug 1033066
Comment on attachment 8495053 [details] [diff] [review] patch 3 - Use atomics for EnsureNextIteration to close races around CurrentDriver Review of attachment 8495053 [details] [diff] [review]: ----------------------------------------------------------------- Why can't we use the graph monitor here?
Attachment #8495053 -
Flags: feedback?(roc)
Assignee | ||
Comment 6•9 years ago
|
||
> Why can't we use the graph monitor here?
We certainly can; the previous patch lock the monitor around accesses to CurrentDriver() from other threads - but there are a lot (and even some SetCurrentDrivers() from other threads in the 'Revive()' case), so it gets messy and increases the chance that MSG threads (or system audio callback threads!) will end up blocked on a monitor held by a thread that won't be scheduled for a bit. Atomics introduce memory barriers but don't block runnability for the MSG/callback.
mNeedAnotherIteration seems like a good use of an Atomic: lots of setters to true; once reader/setter-to-false, and a writer-reader race is ok (we just do an extra iteration, since we set false before starting an iteration, at the end of WaitForNextIteration() with this patch.) Very rarely do we need to do the heavier-weight WakeUp().
Assignee | ||
Comment 7•9 years ago
|
||
Assignee | ||
Comment 8•9 years ago
|
||
https://tbpl.mozilla.org/?tree=Try&rev=0edb7bc464de Looks pretty green
Assignee | ||
Comment 9•9 years ago
|
||
Assignee | ||
Updated•9 years ago
|
Attachment #8495051 -
Attachment is obsolete: true
Assignee | ||
Comment 10•9 years ago
|
||
Assignee | ||
Updated•9 years ago
|
Attachment #8495502 -
Attachment is obsolete: true
Assignee | ||
Comment 11•9 years ago
|
||
Assignee | ||
Updated•9 years ago
|
Attachment #8495053 -
Attachment is obsolete: true
Assignee | ||
Comment 12•9 years ago
|
||
Comment on attachment 8495529 [details] [diff] [review] patch 1 - clean up CurrentDriver() use off-MSG-thread; fix InCallback() The primary thing in this patch is support for controlling the use of CurrentDriver() from non-MSG threads, especially for a common pattern of "do something to a stream, graph->CurrentDriver()->EnsureNextIteration();" The danger was that CurrentDriver() wasn't locked, could change on you, and was a TSAN violation to use like this. Also some other bits of cleanup
Attachment #8495529 -
Flags: review?(roc)
Assignee | ||
Updated•9 years ago
|
Attachment #8495533 -
Flags: review?(roc)
Assignee | ||
Comment 13•9 years ago
|
||
Comment on attachment 8495534 [details] [diff] [review] patch 4 - Use atomics for EnsureNextIteration to close races around CurrentDriver Review of attachment 8495534 [details] [diff] [review]: ----------------------------------------------------------------- This one is optional, but I think is an improvement
Attachment #8495534 -
Flags: review?(roc)
Attachment #8495529 -
Flags: review?(roc) → review+
Comment on attachment 8495533 [details] [diff] [review] patch 3 - Fix up Revive() to not trigger assertions, and also to avoid Init() (blocking) on MainThread Review of attachment 8495533 [details] [diff] [review]: ----------------------------------------------------------------- ::: content/media/MediaStreamGraphImpl.h @@ +440,4 @@ > */ > void SetCurrentDriver(GraphDriver* aDriver) { > + MOZ_ASSERT(mDriver->OnThread() || > + (mMonitor.AssertCurrentThreadOwns(), true)); This is a bit obscure. Please rewrite this as if (!mDriver->OnThread()) { mMonitor.AssertCurrentThreadOwns(); }
Attachment #8495533 -
Flags: review?(roc) → review+
Comment on attachment 8495534 [details] [diff] [review] patch 4 - Use atomics for EnsureNextIteration to close races around CurrentDriver Review of attachment 8495534 [details] [diff] [review]: ----------------------------------------------------------------- I'm not crazy about this but I'm not against it either.
Attachment #8495534 -
Flags: review?(roc) → review+
Assignee | ||
Comment 16•9 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/649d337d331c https://hg.mozilla.org/integration/mozilla-inbound/rev/3f42231c8684 https://hg.mozilla.org/integration/mozilla-inbound/rev/f2138c7f8569 Note: to uplift these, we probably need bug 1072775 which they landed with.
status-b2g-v2.1:
--- → affected
status-firefox34:
--- → affected
status-firefox35:
--- → affected
Whiteboard: [webrtc-uplift]
Target Milestone: --- → mozilla35
Comment 17•9 years ago
|
||
Backed out: https://hg.mozilla.org/integration/mozilla-inbound/rev/0c8faa128dff for fatal assertion failures in Linux64 tests like: Assertion failure: lock->locked && pthread_equal(lock->owner, pthread_self()), at /builds/slave/m-in-l64-d-0000000000000000000/build/nsprpub/pr/src/pthreads/ptsynch.c:226 e.g. https://tbpl.mozilla.org/php/getParsedLog.php?id=49067104&tree=Mozilla-Inbound
Assignee | ||
Comment 18•9 years ago
|
||
Got the boolean backwards when applying the review comment: https://hg.mozilla.org/integration/mozilla-inbound/rev/0860a1ab3506 https://hg.mozilla.org/integration/mozilla-inbound/rev/34c741cf2e57 https://hg.mozilla.org/integration/mozilla-inbound/rev/765e4c810ce0
Comment 19•9 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/649d337d331c https://hg.mozilla.org/mozilla-central/rev/3f42231c8684 https://hg.mozilla.org/mozilla-central/rev/f2138c7f8569 https://hg.mozilla.org/mozilla-central/rev/0860a1ab3506 https://hg.mozilla.org/mozilla-central/rev/34c741cf2e57 https://hg.mozilla.org/mozilla-central/rev/765e4c810ce0
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Assignee | ||
Comment 21•9 years ago
|
||
Comment on attachment 8495529 [details] [diff] [review] patch 1 - clean up CurrentDriver() use off-MSG-thread; fix InCallback() (for all patches, and they need to land with bug 1072775): Approval Request Comment [Feature/regressing bug #]: bug 848954 [User impact if declined]: crashes, test oranges, possible sec issues [Describe test coverage new/current, TBPL]: some known oranges are likely due to this. Adds considerable thread-safety assertions, which caught a bug immediately on landing (which someone had been working and had a fix for, but took them far longer to find after it caused an odd crash) [Risks and why]: fairly low. Cleans up locking around a number of pointers; of course in theory it may have missed something, but it added asserts about safety/locking. Main risk would be missing a case where the assert is too draconian (had one of those on the initial landing) and causing an intermittent orange. [String/UUID change made/needed]: none.
Attachment #8495529 -
Flags: approval-mozilla-aurora?
Assignee | ||
Updated•9 years ago
|
Attachment #8495533 -
Flags: approval-mozilla-aurora?
Assignee | ||
Updated•9 years ago
|
Attachment #8495534 -
Flags: approval-mozilla-aurora?
Updated•9 years ago
|
status-firefox32:
--- → unaffected
status-firefox33:
--- → unaffected
Comment 22•9 years ago
|
||
Comment on attachment 8495529 [details] [diff] [review] patch 1 - clean up CurrentDriver() use off-MSG-thread; fix InCallback() Aurora+
Attachment #8495529 -
Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Comment 23•9 years ago
|
||
Comment on attachment 8495533 [details] [diff] [review] patch 3 - Fix up Revive() to not trigger assertions, and also to avoid Init() (blocking) on MainThread Aurora+
Attachment #8495533 -
Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Comment 24•9 years ago
|
||
Comment on attachment 8495534 [details] [diff] [review] patch 4 - Use atomics for EnsureNextIteration to close races around CurrentDriver Aurora+
Attachment #8495534 -
Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Comment 25•9 years ago
|
||
https://hg.mozilla.org/releases/mozilla-aurora/rev/6fc7dace7ec9 https://hg.mozilla.org/releases/mozilla-aurora/rev/e3397237012d https://hg.mozilla.org/releases/mozilla-aurora/rev/5ef997137570
Updated•9 years ago
|
Flags: qe-verify-
You need to log in
before you can comment on or make changes to this bug.
Description
•