Closed Bug 640935 Opened 13 years ago Closed 13 years ago

Data race on global var vp8_build_intra_predictors_mby_ptr

Categories

(Core :: Audio/Video, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla5

People

(Reporter: jseward, Assigned: derf)

Details

Attachments

(1 file)

TEST_PATH=content/media (test_bug495145.html, perhaps)

When running on latest hacked Helgrind.

Start reading right at the bottom of the report and work up, so as to
avoid getting swamped in detail.  The level of detail produced by
Helgrind is increasing.  It now shows the locks held by the two
conflicting threads, which makes it easier to make sense of the races.

Note that although both threads hold one lock during the conflicting
access, it is not the same lock.  That may or may not be related to
bug 640405 comment 1, which documents another "we don't agree on which
lock to use" phenomenon in the media framework.


172 INFO TEST-PASS | /tests/content/media/test/test_bug495145.html | Playing after pause while ended works for small-shot.ogg#1

----------------------------------------------------------------

Thread #179 was created
   at 0xB2426CE: clone (/build/buildd/eglibc-2.11.1/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:77)
   by 0x4E37172: pthread_create@@GLIBC_2.2.5 (/build/buildd/eglibc-2.11.1/nptl/../nptl/sysdeps/pthread/createthread.c:75)
   by 0x4C2CA4A: pthread_create_WRK (/home/sewardj/VgTRUNK/hgde3/helgrind/hg_intercepts.c:257)
   by 0x4C2CB5E: pthread_create@* (/home/sewardj/VgTRUNK/hgde3/helgrind/hg_intercepts.c:288)
   by 0x79ABE33: _PR_CreateThread (nsprpub/pr/src/pthreads/ptthread.c:432)
   by 0x79AC084: PR_CreateThread (nsprpub/pr/src/pthreads/ptthread.c:515)
   by 0x63375AA: nsThread::Init() (xpcom/threads/nsThread.cpp:355)
   by 0x63385CD: nsThreadManager::NewThread(unsigned int, nsIThread**) (xpcom/threads/nsThreadManager.cpp:249)
   by 0x62F6CD0: NS_NewThread_P(nsIThread**, nsIRunnable*) (ff-opt/xpcom/build/nsThreadUtils.cpp:74)
   by 0x5CA629D: nsBuiltinDecoder::StartStateMachineThread() (content/media/nsBuiltinDecoder.cpp:250)
   by 0x5CA65B5: nsBuiltinDecoder::Load(nsMediaStream*, nsIStreamListener**, nsMediaDecoder*) (content/media/nsBuiltinDecoder.cpp:228)
   by 0x5AC5070: nsHTMLMediaElement::InitializeDecoderForChannel(nsIChannel*, nsIStreamListener**) (content/html/content/src/nsHTMLMediaElement.cpp:1863)
   by 0x5AC5183: nsHTMLMediaElement::MediaLoadListener::OnStartRequest(nsIRequest*, nsISupports*) (content/html/content/src/nsHTMLMediaElement.cpp:304)
   by 0x56DB6A2: nsHttpChannel::CallOnStartRequest() (netwerk/protocol/http/nsHttpChannel.cpp:770)
   by 0x56DB98A: nsHttpChannel::ContinueOnStartRequest3(unsigned int) (netwerk/protocol/http/nsHttpChannel.cpp:3937)
   by 0x56DB9AD: nsHttpChannel::ContinueOnStartRequest2(unsigned int) (netwerk/protocol/http/nsHttpChannel.cpp:3928)
   by 0x56DEEEE: nsHttpChannel::OnStartRequest(nsIRequest*, nsISupports*) (netwerk/protocol/http/nsHttpChannel.cpp:3901)
   by 0x5652753: nsInputStreamPump::OnStateStart() (netwerk/base/src/nsInputStreamPump.cpp:441)
   by 0x5652BF4: nsInputStreamPump::OnInputStreamReady(nsIAsyncInputStream*) (netwerk/base/src/nsInputStreamPump.cpp:397)
   by 0x631F119: nsInputStreamReadyEvent::Run() (xpcom/io/nsStreamUtils.cpp:112)

Thread #178 was created
   at 0xB2426CE: clone (/build/buildd/eglibc-2.11.1/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:77)
   by 0x4E37172: pthread_create@@GLIBC_2.2.5 (/build/buildd/eglibc-2.11.1/nptl/../nptl/sysdeps/pthread/createthread.c:75)
   by 0x4C2CA4A: pthread_create_WRK (/home/sewardj/VgTRUNK/hgde3/helgrind/hg_intercepts.c:257)
   by 0x4C2CB5E: pthread_create@* (/home/sewardj/VgTRUNK/hgde3/helgrind/hg_intercepts.c:288)
   by 0x79ABE33: _PR_CreateThread (nsprpub/pr/src/pthreads/ptthread.c:432)
   by 0x79AC084: PR_CreateThread (nsprpub/pr/src/pthreads/ptthread.c:515)
   by 0x63375AA: nsThread::Init() (xpcom/threads/nsThread.cpp:355)
   by 0x63385CD: nsThreadManager::NewThread(unsigned int, nsIThread**) (xpcom/threads/nsThreadManager.cpp:249)
   by 0x62F6CD0: NS_NewThread_P(nsIThread**, nsIRunnable*) (ff-opt/xpcom/build/nsThreadUtils.cpp:74)
   by 0x5CA629D: nsBuiltinDecoder::StartStateMachineThread() (content/media/nsBuiltinDecoder.cpp:250)
   by 0x5CA65B5: nsBuiltinDecoder::Load(nsMediaStream*, nsIStreamListener**, nsMediaDecoder*) (content/media/nsBuiltinDecoder.cpp:228)
   by 0x5AC5070: nsHTMLMediaElement::InitializeDecoderForChannel(nsIChannel*, nsIStreamListener**) (content/html/content/src/nsHTMLMediaElement.cpp:1863)
   by 0x5AC5183: nsHTMLMediaElement::MediaLoadListener::OnStartRequest(nsIRequest*, nsISupports*) (content/html/content/src/nsHTMLMediaElement.cpp:304)
   by 0x56DB6A2: nsHttpChannel::CallOnStartRequest() (netwerk/protocol/http/nsHttpChannel.cpp:770)
   by 0x56DB98A: nsHttpChannel::ContinueOnStartRequest3(unsigned int) (netwerk/protocol/http/nsHttpChannel.cpp:3937)
   by 0x56DB9AD: nsHttpChannel::ContinueOnStartRequest2(unsigned int) (netwerk/protocol/http/nsHttpChannel.cpp:3928)
   by 0x56DEEEE: nsHttpChannel::OnStartRequest(nsIRequest*, nsISupports*) (netwerk/protocol/http/nsHttpChannel.cpp:3901)
   by 0x5652753: nsInputStreamPump::OnStateStart() (netwerk/base/src/nsInputStreamPump.cpp:441)
   by 0x5652BF4: nsInputStreamPump::OnInputStreamReady(nsIAsyncInputStream*) (netwerk/base/src/nsInputStreamPump.cpp:397)
   by 0x631F119: nsInputStreamReadyEvent::Run() (xpcom/io/nsStreamUtils.cpp:112)

Lock at 0x1F30A5B8 was first observed
   at 0x4C2C8C4: pthread_mutex_init (/home/sewardj/VgTRUNK/hgde3/helgrind/hg_intercepts.c:430)
   by 0x79A5ED8: PR_NewMonitor (nsprpub/pr/src/pthreads/ptsynch.c:517)
   by 0x5CAAF78: nsBuiltinDecoderReader::nsBuiltinDecoderReader(nsBuiltinDecoder*) (ff-opt/content/media/../../dist/include/mozilla/Monitor.h:81)
   by 0x5CC131E: nsWebMReader::nsWebMReader(nsBuiltinDecoder*) (content/media/webm/nsWebMReader.cpp:142)
   by 0x5CC0386: nsWebMDecoder::CreateStateMachine() (content/media/webm/nsWebMDecoder.cpp:46)
   by 0x5CA64E8: nsBuiltinDecoder::Load(nsMediaStream*, nsIStreamListener**, nsMediaDecoder*) (content/media/nsBuiltinDecoder.cpp:209)
   by 0x5AC5070: nsHTMLMediaElement::InitializeDecoderForChannel(nsIChannel*, nsIStreamListener**) (content/html/content/src/nsHTMLMediaElement.cpp:1863)
   by 0x5AC5183: nsHTMLMediaElement::MediaLoadListener::OnStartRequest(nsIRequest*, nsISupports*) (content/html/content/src/nsHTMLMediaElement.cpp:304)
   by 0x56DB6A2: nsHttpChannel::CallOnStartRequest() (netwerk/protocol/http/nsHttpChannel.cpp:770)
   by 0x56DB98A: nsHttpChannel::ContinueOnStartRequest3(unsigned int) (netwerk/protocol/http/nsHttpChannel.cpp:3937)
   by 0x56DB9AD: nsHttpChannel::ContinueOnStartRequest2(unsigned int) (netwerk/protocol/http/nsHttpChannel.cpp:3928)
   by 0x56DEEEE: nsHttpChannel::OnStartRequest(nsIRequest*, nsISupports*) (netwerk/protocol/http/nsHttpChannel.cpp:3901)
   by 0x5652753: nsInputStreamPump::OnStateStart() (netwerk/base/src/nsInputStreamPump.cpp:441)
   by 0x5652BF4: nsInputStreamPump::OnInputStreamReady(nsIAsyncInputStream*) (netwerk/base/src/nsInputStreamPump.cpp:397)
   by 0x631F119: nsInputStreamReadyEvent::Run() (xpcom/io/nsStreamUtils.cpp:112)
   by 0x6336FEC: nsThread::ProcessNextEvent(int, int*) (xpcom/threads/nsThread.cpp:642)
   by 0x62F6B19: NS_ProcessNextEvent_P(nsIThread*, int) (ff-opt/xpcom/build/nsThreadUtils.cpp:250)
   by 0x6337ACE: nsThread::Shutdown() (xpcom/threads/nsThread.cpp:498)
   by 0x5CAA6CD: ShutdownThreadEvent::Run() (ff-opt/content/media/wave/../../../dist/include/nsMediaDecoder.h:73)
   by 0x6336FEC: nsThread::ProcessNextEvent(int, int*) (xpcom/threads/nsThread.cpp:642)

Lock at 0x1E3C2178 was first observed
   at 0x4C2C8C4: pthread_mutex_init (/home/sewardj/VgTRUNK/hgde3/helgrind/hg_intercepts.c:430)
   by 0x79A5ED8: PR_NewMonitor (nsprpub/pr/src/pthreads/ptsynch.c:517)
   by 0x5CAAF78: nsBuiltinDecoderReader::nsBuiltinDecoderReader(nsBuiltinDecoder*) (ff-opt/content/media/../../dist/include/mozilla/Monitor.h:81)
   by 0x5CC131E: nsWebMReader::nsWebMReader(nsBuiltinDecoder*) (content/media/webm/nsWebMReader.cpp:142)
   by 0x5CC0386: nsWebMDecoder::CreateStateMachine() (content/media/webm/nsWebMDecoder.cpp:46)
   by 0x5CA64E8: nsBuiltinDecoder::Load(nsMediaStream*, nsIStreamListener**, nsMediaDecoder*) (content/media/nsBuiltinDecoder.cpp:209)
   by 0x5AC5070: nsHTMLMediaElement::InitializeDecoderForChannel(nsIChannel*, nsIStreamListener**) (content/html/content/src/nsHTMLMediaElement.cpp:1863)
   by 0x5AC5183: nsHTMLMediaElement::MediaLoadListener::OnStartRequest(nsIRequest*, nsISupports*) (content/html/content/src/nsHTMLMediaElement.cpp:304)
   by 0x56DB6A2: nsHttpChannel::CallOnStartRequest() (netwerk/protocol/http/nsHttpChannel.cpp:770)
   by 0x56DB98A: nsHttpChannel::ContinueOnStartRequest3(unsigned int) (netwerk/protocol/http/nsHttpChannel.cpp:3937)
   by 0x56DB9AD: nsHttpChannel::ContinueOnStartRequest2(unsigned int) (netwerk/protocol/http/nsHttpChannel.cpp:3928)
   by 0x56DEEEE: nsHttpChannel::OnStartRequest(nsIRequest*, nsISupports*) (netwerk/protocol/http/nsHttpChannel.cpp:3901)
   by 0x5652753: nsInputStreamPump::OnStateStart() (netwerk/base/src/nsInputStreamPump.cpp:441)
   by 0x5652BF4: nsInputStreamPump::OnInputStreamReady(nsIAsyncInputStream*) (netwerk/base/src/nsInputStreamPump.cpp:397)
   by 0x631F119: nsInputStreamReadyEvent::Run() (xpcom/io/nsStreamUtils.cpp:112)
   by 0x6336FEC: nsThread::ProcessNextEvent(int, int*) (xpcom/threads/nsThread.cpp:642)
   by 0x62F6B19: NS_ProcessNextEvent_P(nsIThread*, int) (ff-opt/xpcom/build/nsThreadUtils.cpp:250)
   by 0x6337ACE: nsThread::Shutdown() (xpcom/threads/nsThread.cpp:498)
   by 0x5CAA6CD: ShutdownThreadEvent::Run() (ff-opt/content/media/wave/../../../dist/include/nsMediaDecoder.h:73)
   by 0x6336FEC: nsThread::ProcessNextEvent(int, int*) (xpcom/threads/nsThread.cpp:642)

Possible data race during write of size 8 at 0x7170418 by thread #179
Locks held: 1: 0x1F30A5B8
   at 0x5CC4B83: vp8_machine_specific_config (media/libvpx/vp8/common/generic/systemdependent.c:77)
   by 0x5CC4CCC: vp8_create_common (media/libvpx/vp8/common/alloccommon.c:166)
   by 0x5CD3DBA: vp8dx_create_decompressor (media/libvpx/vp8/decoder/onyxd_if.c:110)
   by 0x5CD6B3B: vp8_decode (media/libvpx/vp8/vp8_dx_iface.c:386)
   by 0x5CD716A: vpx_codec_decode (media/libvpx/vpx/src/vpx_decoder.c:127)
   by 0x5CC1A63: nsWebMReader::DecodeVideoFrame(int&, long) (content/media/webm/nsWebMReader.cpp:690)
   by 0x5CAC937: nsBuiltinDecoderReader::DecodeVideoFrame() (content/media/nsBuiltinDecoderReader.h:541)
   by 0x5CACA04: VideoData* nsBuiltinDecoderReader::DecodeToFirstData<VideoData>(int (nsBuiltinDecoderReader::*)(), MediaQueue<VideoData>&) (content/media/nsBuiltinDecoderReader.cpp:366)
   by 0x5CAB32C: nsBuiltinDecoderReader::FindStartTime(long, long&) (content/media/nsBuiltinDecoderReader.cpp:328)
   by 0x5CA711F: nsBuiltinDecoderStateMachine::FindStartTime() (content/media/nsBuiltinDecoderStateMachine.cpp:1452)
   by 0x5CA9ECE: nsBuiltinDecoderStateMachine::Run() (content/media/nsBuiltinDecoderStateMachine.cpp:989)
   by 0x6336FEC: nsThread::ProcessNextEvent(int, int*) (xpcom/threads/nsThread.cpp:642)
   by 0x62F6B19: NS_ProcessNextEvent_P(nsIThread*, int) (ff-opt/xpcom/build/nsThreadUtils.cpp:250)
   by 0x63376FC: nsThread::ThreadFunc(void*) (xpcom/threads/nsThread.cpp:281)
   by 0x79ABACC: _pt_root (nsprpub/pr/src/pthreads/ptthread.c:189)
   by 0x4C2CBE7: mythread_wrapper (/home/sewardj/VgTRUNK/hgde3/helgrind/hg_intercepts.c:221)
   by 0x4E369C9: start_thread (/build/buildd/eglibc-2.11.1/nptl/pthread_create.c:300)
   by 0xB24270C: clone (/build/buildd/eglibc-2.11.1/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:112)

This conflicts with a previous write of size 8 by thread #178
Locks held: 1: 0x1E3C2178
   at 0x5CC4B83: vp8_machine_specific_config (media/libvpx/vp8/common/generic/systemdependent.c:77)
   by 0x5CC4CCC: vp8_create_common (media/libvpx/vp8/common/alloccommon.c:166)
   by 0x5CD3DBA: vp8dx_create_decompressor (media/libvpx/vp8/decoder/onyxd_if.c:110)
   by 0x5CD6B3B: vp8_decode (media/libvpx/vp8/vp8_dx_iface.c:386)
   by 0x5CD716A: vpx_codec_decode (media/libvpx/vpx/src/vpx_decoder.c:127)
   by 0x5CC1A63: nsWebMReader::DecodeVideoFrame(int&, long) (content/media/webm/nsWebMReader.cpp:690)
   by 0x5CAC937: nsBuiltinDecoderReader::DecodeVideoFrame() (content/media/nsBuiltinDecoderReader.h:541)
   by 0x5CACA04: VideoData* nsBuiltinDecoderReader::DecodeToFirstData<VideoData>(int (nsBuiltinDecoderReader::*)(), MediaQueue<VideoData>&) (content/media/nsBuiltinDecoderReader.cpp:366)

Location 0x7170418 is 0 bytes inside global var "vp8_build_intra_predictors_mby_ptr"
declared at systemdependent.c:23

----------------------------------------------------------------
This should now be fixed upstream:
https://review.webmproject.org/#change,1961

I'll prepare a patch against our local copy.
Assignee: nobody → tterribe
Status: NEW → ASSIGNED
Attachment #522927 - Flags: review?(chris)
(In reply to comment #2)
> Port of upstream change 1961

With this in place, I can no longer repro the race.  +1 from me therefore.

note (just in case)
is much easier to reproduce the race with this
TEST_PATH=content/media/test/test_seek.html

than with test_bug495145.html as stated in comment #0.
Attachment #522927 - Flags: review?(chris) → review+
http://hg.mozilla.org/mozilla-central/rev/56c1a338a41f
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla2.2
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: