Closed Bug 1130253 Opened 5 years ago Closed 5 years ago

Crash when shutting down: Assertion failure: mIsShutdown, dom/media/MediaTaskQueue.cpp:26

Categories

(Core :: Audio/Video, defect, P1)

x86
macOS
defect

Tracking

()

RESOLVED FIXED
Tracking Status
firefox37 + fixed
firefox38 --- fixed

People

(Reporter: jya, Assigned: bholley)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

This happened while playing the YouTube test:
http://yt-dash-mse-test.commondatastorage.googleapis.com/unit-tests/2015.html?timestamp=1419893566526

2066494208[1004481a0]: MediaSource(13624b280)::Detach() mDecoder=0 owner=0
Assertion failure: mIsShutdown, at /Users/jyavenard/Work/Mozilla/mozilla-central/dom/media/MediaTaskQueue.cpp:26
JavaScript error: , line 0: uncaught exception: Test Seek TIMED OUT!
#01: mozilla::MediaTaskQueue::~MediaTaskQueue()[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x2cc51ad]
#02: mozilla::MediaTaskQueue::~MediaTaskQueue()[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x2cc5265]
#03: mozilla::MediaTaskQueue::Release()[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x2ce9872]
#04: nsRefPtr<mozilla::MediaTaskQueue>::~nsRefPtr()[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x2cfbced]
#05: nsRefPtr<mozilla::MediaTaskQueue>::~nsRefPtr()[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x2ccc555]
#06: mozilla::AVCCMediaDataDecoder::~AVCCMediaDataDecoder()[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x2e8efe7]
#07: mozilla::AVCCMediaDataDecoder::~AVCCMediaDataDecoder()[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x2e8f045]
#08: mozilla::AVCCMediaDataDecoder::~AVCCMediaDataDecoder()[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x2e8f069]
#09: mozilla::MediaDataDecoder::Release()[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x2e8d748]
#10: nsRefPtr<mozilla::MediaDataDecoder>::~nsRefPtr()[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x2e8ebdd]
#11: nsRefPtr<mozilla::MediaDataDecoder>::~nsRefPtr()[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x2e8eba5]
#12: mozilla::MP4Reader::DecoderData::~DecoderData()[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x2e8eb3d]
#13: mozilla::MP4Reader::DecoderDataWithPromise<mozilla::MediaPromise<nsRefPtr<mozilla::VideoData>, mozilla::MediaDecoderReader::NotDecodedReason, true> >::~DecoderDataWithPromise()[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x2e8ecc1]
#14: mozilla::MP4Reader::DecoderDataWithPromise<mozilla::MediaPromise<nsRefPtr<mozilla::VideoData>, mozilla::MediaDecoderReader::NotDecodedReason, true> >::~DecoderDataWithPromise()[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x2e8b0b5]
#15: mozilla::MP4Reader::~MP4Reader()[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x2e868bb]
#16: mozilla::MP4Reader::~MP4Reader()[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x2e86935]
#17: mozilla::MP4Reader::~MP4Reader()[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x2e86959]
#18: mozilla::MediaDecoderReader::Release()[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x2cf696b]
#19: nsRefPtr<mozilla::MediaDecoderReader>::~nsRefPtr()[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x2cfbb4d]
#20: nsRefPtr<mozilla::MediaDecoderReader>::~nsRefPtr()[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x2ccdac5]
#21: mozilla::SourceBufferDecoder::~SourceBufferDecoder()[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x2d99a95]
#22: mozilla::SourceBufferDecoder::~SourceBufferDecoder()[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x2d99ad5]
#23: mozilla::SourceBufferDecoder::~SourceBufferDecoder()[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x2d99af9]
#24: mozilla::SourceBufferDecoder::Release()[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x2d9980c]
#25: mozilla::RefPtr<mozilla::SourceBufferDecoder>::unref(mozilla::SourceBufferDecoder*)[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x2db33a3]
#26: mozilla::RefPtr<mozilla::SourceBufferDecoder>::~RefPtr()[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x2db3378]
#27: mozilla::RefPtr<mozilla::SourceBufferDecoder>::~RefPtr()[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x2db3355]
#28: mozilla::DelayedDispatchToMainThread::~DelayedDispatchToMainThread()[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x2db3325]
#29: mozilla::DelayedDispatchToMainThread::~DelayedDispatchToMainThread()[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x2db32b5]
#30: mozilla::DelayedDispatchToMainThread::~DelayedDispatchToMainThread()[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x2db32d9]
#31: nsRunnable::Release()[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x1dbc09]
#32: mozilla::RefPtr<nsIRunnable>::unref(nsIRunnable*)[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x2c76eba]
#33: mozilla::RefPtr<nsIRunnable>::~RefPtr()[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x2cfe538]
#34: mozilla::RefPtr<nsIRunnable>::~RefPtr()[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x2cccc25]
#35: mozilla::MediaTaskQueue::TaskQueueEntry::~TaskQueueEntry()[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x2d04a55]
#36: mozilla::MediaTaskQueue::TaskQueueEntry::~TaskQueueEntry()[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x2cd8bb5]
#37: __gnu_cxx::new_allocator<mozilla::MediaTaskQueue::TaskQueueEntry>::destroy(mozilla::MediaTaskQueue::TaskQueueEntry*)[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x2cdb1d9]
#38: std::deque<mozilla::MediaTaskQueue::TaskQueueEntry, std::allocator<mozilla::MediaTaskQueue::TaskQueueEntry> >::pop_front()[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x2cdb190]
#39: std::queue<mozilla::MediaTaskQueue::TaskQueueEntry, std::deque<mozilla::MediaTaskQueue::TaskQueueEntry, std::allocator<mozilla::MediaTaskQueue::TaskQueueEntry> > >::pop()[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x2cd9045]
#40: mozilla::MediaTaskQueue::FlushLocked()[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x2cc5896]
#41: mozilla::MediaTaskQueue::FlushAndDispatch(mozilla::TemporaryRef<nsIRunnable>)[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x2ca3be7]
#42: mozilla::MediaDecoderStateMachine::FlushDecoding()[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x2ca3046]
#43: mozilla::MediaDecoderStateMachine::RunStateMachine()[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x2ca1fda]
2066494208[1004481a0]: MediaSource(13624b280) Dispatch event 'sourceclose'
2066494208[1004481a0]: SourceBufferList(12e195bc0) Dispatch event 'removesourcebuffer'
2066494208[1004481a0]: SourceBufferList(12e195b60) Dispatch event 'removesourcebuffer'
#44: mozilla::MediaDecoderStateMachine::CallRunStateMachine()[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x2ca4057]
#45: mozilla::MediaDecoderStateMachine::TimeoutExpired(void*)[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x2c9563d]
#46: mozilla::MediaDecoderStateMachineScheduler::TimeoutExpired(int)[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x2ca4cac]
#47: (anonymous namespace)::TimerEvent::Run()[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x2cc9ccf]
#48: non-virtual thunk to (anonymous namespace)::TimerEvent::Run()[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x2cc9dfc]
2066494208[1004481a0]: MediaSource(1436d3100)::MediaSource(aWindow=12f270420) mSourceBuffers=12f7f4e20 mActiveSourceBuffers=12f7f4fa0
#49: nsThreadPool::Run()[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x185ee7]
#50: non-virtual thunk to nsThreadPool::Run()[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x185fdc]
#51: nsThread::ProcessNextEvent(bool, bool*)[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x182948]
2066494208[1004481a0]: MediaSource(1436d3100)::Attach(aDecoder=12f7d9b00) owner=134349ca0
2066494208[1004481a0]: MediaSource(1436d3100)::SetReadyState(aState=1) mReadyState=0
2066494208[1004481a0]: MediaSource(1436d3100) Queuing event 'sourceopen'
2066494208[1004481a0]: Decoder=12f7d9b00 SetMinimizePrerollUntilPlaybackStarts()
#52: NS_ProcessNextEvent(nsIThread*, bool)[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x1dc6b7]
#53: mozilla::ipc::MessagePumpForNonMainThreads::Run(base::MessagePump::Delegate*)[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x80d843]
#54: MessageLoop::RunInternal()[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x7a2875]
#55: MessageLoop::RunHandler()[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x7a2785]
#56: MessageLoop::Run()[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x7a272d]
#57: nsThread::ThreadFunc(void*)[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x180dd6]
#58: _pt_root[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/libnss3.dylib +0x37445f]
#59: _pthread_body[/usr/lib/system/libsystem_pthread.dylib +0x3268]
#60: _pthread_body[/usr/lib/system/libsystem_pthread.dylib +0x31e5]
(lldb)
Sounds similar to bug 1129877.

We crash due the promise not being detached when shutting down
See Also: → 1129877
Attached file logcrash.txt.zip
Entire log of the transaction
I also filed a media shutdown hang in bug 1129455, maybe that's related (or might be completely different, I don't know).
Priority: -- → P1
The problem here is that MediaDecoderReader::Shutdown() returns a promise, but TrackBuffer::RemoveDecoder assumes that it happens synchronously. I'll take this.
Assignee: nobody → bobbyholley
(In reply to Bobby Holley (Busy with media, don't ask for DOM/JS/XPConnect things) from comment #4)
> The problem here is that MediaDecoderReader::Shutdown() returns a promise,
> but TrackBuffer::RemoveDecoder assumes that it happens synchronously. I'll
> take this.

Oh no, that's not it, because MP4Reader::Shutdown does AwaitIdle while shutting down its task queues, and so it's effectively synchronous. I'll explain what's actually happening here in the next comment.
The problem here is basically that task queue flushing is totally insane and needs to go away.

We get ourselves into shutdown state, so we invoke MDSM::FlushDecoding, which flushes the task queue. This destroys a DelayedDispatchToMainThread (on the calling thread!) without giving it a chance to run, which means that it release the subdecoder on the wrong thread and without having called shutdown, and stuff break.

The solution is to get rid of flushing. I'm going to try to do bug 1125970 and pick up where cpearce left off.
Depends on: 1125970
Tracking all MSE P1 bugs for Firefox 37.
This should be fixed by bug 1125970.
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Bug 1125970 landed in 38 and was uplifted to 37. Marking 37+ as fixed.
You need to log in before you can comment on or make changes to this bug.