Closed Bug 1080958 Opened 10 years ago Closed 10 years ago

Media no longer plays due to MDStateMachine blocked by old MSE ReadMetadata()

Categories

(Core :: Audio/Video, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla35

People

(Reporter: karlt, Assigned: karlt)

References

Details

Attachments

(1 file)

There is one MDStateMachine thread, which is blocked in a MDStateMachine at
DECODER_STATE_SHUTDOWN waiting for mDecodeTaskQueue->Shutdown().

That is waiting for a task with TrackBuffer::Shutdown() waiting for its
decoder-initialization mTaskQueue->Shutdown().

That is waiting in SourceBufferResource::Read() from
TrackBuffer::InitializeDecoder() calling reader->ReadMetadata().

The pages using MSE are no longer the current document.

Reproduced by

1. enabling these web platform tests annotated with current timeouts and
   failures.

  testing/web-platform/meta/media-source/mediasource-buffered.html.ini
  testing/web-platform/meta/media-source/mediasource-sourcebuffer-mode.html.ini

2. run

  ./mach web-platform-tests --include=media-source/ --include=old-tests/submission/Microsoft/sandbox/sandbox_002.htm --test-types testharness --pause-on-unexpected

Expected: sandbox_002.htm passes.
Actual: times out.
(gdb) thread 10
[Switching to thread 10 (Thread 0x7fdc07a4e700 (LWP 18683))]
#0  pthread_cond_wait ()
    at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
185	in ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
(gdb) bt 12
#0  pthread_cond_wait ()
    at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x00007fdc4d051846 in PR_WaitCondVar (cvar=0x7fdbe92643c0, 
    timeout=4294967295)
    at /mnt/ssd1/karl/moz/dev/nsprpub/pr/src/pthreads/ptsynch.c:385
#2  0x00007fdc449e8fe5 in mozilla::CondVar::Wait (this=0x7fdc02f69bf0, 
    aInterval=4294967295)
    at /mnt/ssd1/karl/moz/dev/xpcom/glue/BlockingResourceBase.cpp:497
#3  0x00007fdc449bbf3a in mozilla::Monitor::Wait (this=0x7fdc02f69bd0, 
    aInterval=4294967295) at ../../dist/include/mozilla/Monitor.h:40
#4  0x00007fdc46edd465 in mozilla::MediaTaskQueue::AwaitIdleLocked (
    this=0x7fdc02f69bc0)
    at /mnt/ssd1/karl/moz/dev/content/media/MediaTaskQueue.cpp:116
#5  0x00007fdc46edd4b0 in mozilla::MediaTaskQueue::Shutdown (
    this=0x7fdc02f69bc0)
    at /mnt/ssd1/karl/moz/dev/content/media/MediaTaskQueue.cpp:125
#6  0x00007fdc46ec4e02 in mozilla::MediaDecoderStateMachine::RunStateMachine (
    this=0x7fdbfe359c00)
    at /mnt/ssd1/karl/moz/dev/content/media/MediaDecoderStateMachine.cpp:2315
#7  0x00007fdc46ec7a6b in mozilla::MediaDecoderStateMachine::CallRunStateMachine (this=0x7fdbfe359c00)
    at /mnt/ssd1/karl/moz/dev/content/media/MediaDecoderStateMachine.cpp:3009
#8  0x00007fdc46ec7a8e in mozilla::MediaDecoderStateMachine::TimeoutExpired (
    aClosure=0x7fdbfe359c00)
    at /mnt/ssd1/karl/moz/dev/content/media/MediaDecoderStateMachine.cpp:3015
#9  0x00007fdc46ec8dcd in mozilla::MediaDecoderStateMachineScheduler::TimeoutExpired (this=0x7fdc19348510, aTimerId=4)
    at /mnt/ssd1/karl/moz/dev/content/media/MediaDecoderStateMachineScheduler.cpp:183
#10 0x00007fdc46ec82e1 in (anonymous namespace)::TimerEvent::Run (
    this=0x7fdbbe6f9130)
    at /mnt/ssd1/karl/moz/dev/content/media/MediaDecoderStateMachineScheduler.cpp:31
#11 0x00007fdc449b908f in nsThreadPool::Run (this=0x7fdbf7ee68a0)
    at /mnt/ssd1/karl/moz/dev/xpcom/threads/nsThreadPool.cpp:220
(More stack frames follow...)
(gdb) f 4
#4  0x00007fdc46edd465 in mozilla::MediaTaskQueue::AwaitIdleLocked (
    this=0x7fdc02f69bc0)
    at /mnt/ssd1/karl/moz/dev/content/media/MediaTaskQueue.cpp:116
(gdb) p mRunningThread.mPtr->mThread->tid
$8 = 18715
(gdb) thread 6
[Switching to thread 6 (Thread 0x7fdbfe955700 (LWP 18715))]
#0  pthread_cond_wait ()
    at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
185	in ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
(gdb) bt 12
#0  pthread_cond_wait ()
    at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x00007fdc4d051846 in PR_WaitCondVar (cvar=0x7fdbbe4f7980, 
    timeout=4294967295)
    at /mnt/ssd1/karl/moz/dev/nsprpub/pr/src/pthreads/ptsynch.c:385
#2  0x00007fdc449e8fe5 in mozilla::CondVar::Wait (this=0x7fdc192e76f0, 
    aInterval=4294967295)
    at /mnt/ssd1/karl/moz/dev/xpcom/glue/BlockingResourceBase.cpp:497
#3  0x00007fdc449bbf3a in mozilla::Monitor::Wait (this=0x7fdc192e76d0, 
    aInterval=4294967295) at ../../dist/include/mozilla/Monitor.h:40
#4  0x00007fdc46edd465 in mozilla::MediaTaskQueue::AwaitIdleLocked (
    this=0x7fdc192e76c0)
    at /mnt/ssd1/karl/moz/dev/content/media/MediaTaskQueue.cpp:116
#5  0x00007fdc46edd4b0 in mozilla::MediaTaskQueue::Shutdown (
    this=0x7fdc192e76c0)
    at /mnt/ssd1/karl/moz/dev/content/media/MediaTaskQueue.cpp:125
#6  0x00007fdc46f47fbd in mozilla::TrackBuffer::Shutdown (this=0x7fdbbdd9fdf0)
    at /mnt/ssd1/karl/moz/dev/content/media/mediasource/TrackBuffer.cpp:81
#7  0x00007fdc46f420c1 in mozilla::MediaSourceReader::Shutdown (
    this=0x7fdbfe356400)
    at /mnt/ssd1/karl/moz/dev/content/media/mediasource/MediaSourceReader.cpp:210
#8  0x00007fdc46f03e98 in nsRunnableMethodImpl<void (mozilla::MediaDecoderReader::*)(), void, true>::Run (this=0x7fdbbe6f90a0)
    at ../../dist/include/nsThreadUtils.h:388
#9  0x00007fdc46edd90c in mozilla::MediaTaskQueue::Runner::Run (
    this=0x7fdbbdda11a0)
    at /mnt/ssd1/karl/moz/dev/content/media/MediaTaskQueue.cpp:194
#10 0x00007fdc449b908f in nsThreadPool::Run (this=0x7fdbf8d1cd40)
    at /mnt/ssd1/karl/moz/dev/xpcom/threads/nsThreadPool.cpp:220
#11 0x00007fdc449b656c in nsThread::ProcessNextEvent (this=0x7fdbf5edb400, 
    aMayWait=false, aResult=0x7fdbfe954d1f)
    at /mnt/ssd1/karl/moz/dev/xpcom/threads/nsThread.cpp:830
(More stack frames follow...)
(gdb) f 4
#4  0x00007fdc46edd465 in mozilla::MediaTaskQueue::AwaitIdleLocked (
    this=0x7fdc192e76c0)
    at /mnt/ssd1/karl/moz/dev/content/media/MediaTaskQueue.cpp:116
(gdb) p mRunningThread.mPtr->mThread->tid
$9 = 18700
(gdb) thread 7
[Switching to thread 7 (Thread 0x7fdbf9efd700 (LWP 18700))]
#0  pthread_cond_wait ()
    at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
185	in ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
(gdb) bt 17
#0  pthread_cond_wait ()
    at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x00007fdc4d052465 in PR_Wait (mon=0x7fdbf5fd3a00, timeout=4294967295)
    at /mnt/ssd1/karl/moz/dev/nsprpub/pr/src/pthreads/ptsynch.c:691
#2  0x00007fdc449e8f28 in mozilla::ReentrantMonitor::Wait (
    this=0x7fdbbddfe898, aInterval=4294967295)
    at /mnt/ssd1/karl/moz/dev/xpcom/glue/BlockingResourceBase.cpp:466
#3  0x00007fdc449895f7 in mozilla::ReentrantMonitorAutoEnter::Wait (
    this=0x7fdbf9efc530, aInterval=4294967295)
    at ../../dist/include/mozilla/ReentrantMonitor.h:190
#4  0x00007fdc46f47463 in mozilla::SourceBufferResource::Read (
    this=0x7fdbbddfe870, aBuffer=0x7fdbbde99020 "", aCount=16384, 
    aBytes=0x7fdbf9efc58c)
    at /mnt/ssd1/karl/moz/dev/content/media/mediasource/SourceBufferResource.cpp:57
#5  0x00007fdc46fc7326 in mozilla::webm_read (aBuffer=0x7fdbbde99020, 
    aLength=16384, aUserData=0x7fdbf5fa53c0)
    at /mnt/ssd1/karl/moz/dev/content/media/webm/WebMReader.cpp:77
#6  0x00007fdc47ec71cf in ne_io_read (io=0x7fdbbde99000, 
    buffer=0x7fdbf9efc64b, length=1)
    at /mnt/ssd1/karl/moz/dev/media/libnestegg/src/nestegg.c:585
#7  0x00007fdc47ec751d in ne_bare_read_vint (io=0x7fdbbde99000, 
    value=0x7fdc0bbbdcd8, length=0x0, maskflag=MASK_NONE)
    at /mnt/ssd1/karl/moz/dev/media/libnestegg/src/nestegg.c:675
#8  0x00007fdc47ec7621 in ne_read_id (io=0x7fdbbde99000, 
    value=0x7fdc0bbbdcd8, length=0x0)
    at /mnt/ssd1/karl/moz/dev/media/libnestegg/src/nestegg.c:707
#9  0x00007fdc47ec7e3e in ne_peek_element (ctx=0x7fdc0bbbdcc0, 
    id=0x7fdbf9efc740, size=0x0)
    at /mnt/ssd1/karl/moz/dev/media/libnestegg/src/nestegg.c:986
#10 0x00007fdc47eca4c0 in nestegg_init (context=0x7fdbf693a220, io=..., 
    callback=0x7fdc46fc7534 <mozilla::webm_log(nestegg*, unsigned int, char const*, ...)>, max_offset=-1)
    at /mnt/ssd1/karl/moz/dev/media/libnestegg/src/nestegg.c:2020
#11 0x00007fdc46fc7e64 in mozilla::WebMReader::ReadMetadata (
    this=0x7fdbf693a000, aInfo=0x7fdbf9efc940, aTags=0x7fdbf9efc9f0)
    at /mnt/ssd1/karl/moz/dev/content/media/webm/WebMReader.cpp:290
#12 0x00007fdc46f48e22 in mozilla::TrackBuffer::InitializeDecoder (
    this=0x7fdbbdd9fdf0, aDecoder=0x7fdbf5fa53c0)
    at /mnt/ssd1/karl/moz/dev/content/media/mediasource/TrackBuffer.cpp:270
#13 0x00007fdc46f51873 in nsRunnableMethodImpl<void (mozilla::TrackBuffer::*)(mozilla::SourceBufferDecoder*), mozilla::SourceBufferDecoder*, true>::Run (
    this=0x7fdbf5fa5440) at ../../../dist/include/nsThreadUtils.h:363
#14 0x00007fdc46edd90c in mozilla::MediaTaskQueue::Runner::Run (
    this=0x7fdbe92657a0)
    at /mnt/ssd1/karl/moz/dev/content/media/MediaTaskQueue.cpp:194
#15 0x00007fdc449b908f in nsThreadPool::Run (this=0x7fdbf8d1cd40)
    at /mnt/ssd1/karl/moz/dev/xpcom/threads/nsThreadPool.cpp:220
#16 0x00007fdc449b656c in nsThread::ProcessNextEvent (this=0x7fdbf5edc4e0, 
    aMayWait=false, aResult=0x7fdbf9efcd1f)
    at /mnt/ssd1/karl/moz/dev/xpcom/threads/nsThread.cpp:830
(More stack frames follow...)
Comment on attachment 8502960 [details] [diff] [review]
end current SourceBufferResource before Shutdown of TrackBuffer::mTaskQueue

Review of attachment 8502960 [details] [diff] [review]:
-----------------------------------------------------------------

::: content/media/mediasource/TrackBuffer.cpp
@@ +77,5 @@
>  {
> +  // End the SourceBufferResource associated with mCurrentDecoder, which will
> +  // unblock any decoder initialization in ReadMetadata().
> +  DiscardDecoder();
> +  // Finish any decoder initialization, which may add to mInitializedDecoders.

Newline between DiscardDecoder and next comment.
Attachment #8502960 - Flags: review?(kinetik) → review+
https://hg.mozilla.org/integration/mozilla-inbound/rev/2d0a1d871700
https://hg.mozilla.org/integration/mozilla-inbound/rev/86da49382e3b

Try says that we can't enable mediasource-buffered.html and mediasource-sourcebuffer-mode.html (which were fine locally) yet.  They are still experiencing the same failure in sandbox_002.htm.

Some other disabled tests generate the same failure when enabled locally, and something in attachment 8496656 [details] [diff] [review] seems to be fixing that.
https://hg.mozilla.org/mozilla-central/rev/2d0a1d871700
https://hg.mozilla.org/mozilla-central/rev/86da49382e3b
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla35
This changeset was meant to land labelled with bug 1082206, where this bug was fixed properly, but it should be better tested now.

https://hg.mozilla.org/integration/mozilla-inbound/rev/2839cfaaa883
Flags: in-testsuite+
You need to log in before you can comment on or make changes to this bug.