Closed Bug 1618444 Opened 4 years ago Closed 4 years ago

Crash in EnsureNextIteration() from SourceMediaTrack::AppendData() due to race with MediaTrackGraphShutDownRunnable

Categories

(Core :: Audio/Video: MediaStreamGraph, defect, P2)

defect

Tracking

()

RESOLVED FIXED
mozilla75
Tracking Status
firefox-esr68 --- unaffected
firefox73 --- disabled
firefox74 --- disabled
firefox75 --- disabled

People

(Reporter: karlt, Assigned: karlt)

References

(Regression)

Details

(Keywords: regression)

Attachments

(1 file)

This was caught with ./mach mochitest --keep-open=false --debugger=rr dom/media/tests/mochitest/test_getUserMedia_audioCapture.html
https://pernos.co/debug/TBL9mENXKG17AXYB84fcLA/index.html

I did have some patches for bug 1596655 applied, but I'm not aware of contributing effects from them.

Graph shutdown is apparently triggered on "xpcom-will-shutdown", which leads to clearing of mDriver on the main thread.

SourceMediaTrack::AppendData(), called on the MediaDecoderStateMachine thread, acquires the track mutex and checks for GraphImpl() as well as mUpdateTrack->mEnded.

It then acquires the graph mutex and calls graph->EnsureNextIteration(), which crashes on null mDriver.

This is probably triggered by https://hg.mozilla.org/integration/autoland/rev/2523464caf47#l4.36
because previously mGraphDriverAsleep would have been false when the graph driver handed control from graph thread to main thread.

It doesn't affect release builds because their content processes don't go through XPCOM shutdown.

Priority: -- → P2
Regressed by: 1586370
Has Regression Range: --- → yes

I first looked into calling End() from SourceMediaTrack::NotifyForcedShutdown(), but I don't know that we can rule out a new SourceMediaTrack being added after those calls.

The driver can be safely checked and used with the monitor held, because the
driver is changed only while the monitor is held.

Pushed by ktomlinson@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/fccd2c39ce30
don't EnsureNextIteration() in AppendData() after forced shutdown r=padenot
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla75
See Also: → 1633493
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: