bugGnash - The GNU Flash player - Bugs: bug #42551, Data race for...

 
 

bug #42551: Data race for MediaParser::_audioFrames

Submitted by:  Bastiaan Jacques <bjacques>
Submitted on:  Fri 13 Jun 2014 02:53:33 PM UTC  
 
Category:  None Severity:  4 - Important
Release:  None Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Fri 13 Jun 2014 02:53:33 PM UTC, original submission:  

Thread Sanitizer reports, when running actionscript.all/Video-v5.swf:

==================
WARNING: ThreadSanitizer: data race (pid=3827)
  Write of size 8 at 0x7d500000e410 by main thread (mutexes: write M2191):
    #0 std::unique_ptr<gnash::media::EncodedAudioFrame, std::default_delete<gnash::media::EncodedAudioFrame> >::release() /usr/include/c++/4.9.0/bits/unique_ptr.h:328 (libgn
ashmedia-0.8.11dev.so+0x000000032b77)
    #1 std::unique_ptr<gnash::media::EncodedAudioFrame, std::default_delete<gnash::media::EncodedAudioFrame> >::operator=(std::unique_ptr<gnash::media::EncodedAudioFrame, st
d::default_delete<gnash::media::EncodedAudioFrame> >&&) /usr/include/c++/4.9.0/bits/unique_ptr.h:251 (libgnashmedia-0.8.11dev.so+0x000000032b77)
    #2 gnash::media::MediaParser::nextAudioFrame() /home/bastiaan/gnash/libmedia/MediaParser.cpp:233 (libgnashmedia-0.8.11dev.so+0x000000032b77)
    #3 gnash::NetStream_as::decodeNextAudioFrame() /home/bastiaan/gnash/libcore/asobj/NetStream_as.cpp:673 (libgnashcore-0.8.11dev.so+0x0000002536eb)
    #4 gnash::NetStream_as::pushDecodedAudioFrames(unsigned int) /home/bastiaan/gnash/libcore/asobj/NetStream_as.cpp:1008 (libgnashcore-0.8.11dev.so+0x00000025b4fb)
    #5 gnash::NetStream_as::refreshAudioBuffer() /home/bastiaan/gnash/libcore/asobj/NetStream_as.cpp:827 (libgnashcore-0.8.11dev.so+0x00000025b86b)
    #6 gnash::NetStream_as::update() /home/bastiaan/gnash/libcore/asobj/NetStream_as.cpp:1318 (libgnashcore-0.8.11dev.so+0x00000025ba60)
    #7 operator() /home/bastiaan/gnash/libcore/movie_root.cpp:108 (libgnashcore-0.8.11dev.so+0x0000000ed687)
    #8 for_each<__gnu_cxx::__normal_iterator<gnash::as_object**, std::vector<gnash::as_object*> >, gnash::(anonymous namespace)::ExecuteCallback> /usr/include/c++/4.9.0/bits/stl_algo.h:3755 (libgnashcore-0.8.11dev.so+0x0000000ed687)
    #9 gnash::movie_root::executeAdvanceCallbacks() /home/bastiaan/gnash/libcore/movie_root.cpp:1543 (libgnashcore-0.8.11dev.so+0x0000000ed687)
    #10 gnash::movie_root::advance() /home/bastiaan/gnash/libcore/movie_root.cpp:941 (libgnashcore-0.8.11dev.so+0x0000000ee273)
    #11 gnash::movie_root::processActionQueue() /home/bastiaan/gnash/libcore/movie_root.cpp:1481 (libgnashcore-0.8.11dev.so+0x0000000dd279)
    #12 gnash::movie_root::advanceMovie() /home/bastiaan/gnash/libcore/movie_root.cpp:982 (libgnashcore-0.8.11dev.so+0x0000000dea4c)
    #13 gnash::movie_root::advance() /home/bastiaan/gnash/libcore/movie_root.cpp:933 (libgnashcore-0.8.11dev.so+0x0000000ee249)
    #14 play_movie /home/bastiaan/gnash/utilities/processor.cpp:532 (lt-gprocessor+0x000000009757)
    #15 main /home/bastiaan/gnash/utilities/processor.cpp:376 (lt-gprocessor+0x00000000b0e0)

  Previous read of size 8 at 0x7d500000e410 by thread T3:
    #0 std::unique_ptr<gnash::media::EncodedAudioFrame, std::default_delete<gnash::media::EncodedAudioFrame> >::get() const /usr/include/c++/4.9.0/bits/unique_ptr.h:305 (libgnashmedia-0.8.11dev.so+0x0000000323fc)
    #1 std::unique_ptr<gnash::media::EncodedAudioFrame, std::default_delete<gnash::media::EncodedAudioFrame> >::operator->() const /usr/include/c++/4.9.0/bits/unique_ptr.h:299 (libgnashmedia-0.8.11dev.so+0x0000000323fc)
    #2 gnash::media::MediaParser::audioBufferLength() const /home/bastiaan/gnash/libmedia/MediaParser.cpp:124 (libgnashmedia-0.8.11dev.so+0x0000000323fc)
    #3 gnash::media::MediaParser::getBufferLengthNoLock() const /home/bastiaan/gnash/libmedia/MediaParser.cpp:93 (libgnashmedia-0.8.11dev.so+0x000000032477)
    #4 gnash::media::MediaParser::bufferFull() const /home/bastiaan/gnash/libmedia/MediaParser.cpp:399 (libgnashmedia-0.8.11dev.so+0x000000033004)
    #5 gnash::media::FLVParser::parseNextChunk() /home/bastiaan/gnash/libmedia/FLVParser.cpp:125 (libgnashmedia-0.8.11dev.so+0x0000000264c0)
    #6 gnash::media::MediaParser::parserLoop() /home/bastiaan/gnash/libmedia/MediaParser.cpp:412 (libgnashmedia-0.8.11dev.so+0x00000003345e)
    #7 operator()<, void> /usr/include/c++/4.9.0/functional:569 (libgnashmedia-0.8.11dev.so+0x0000000365f3)
    #8 _M_invoke<0ul> /usr/include/c++/4.9.0/functional:1700 (libgnashmedia-0.8.11dev.so+0x0000000365f3)
    #9 std::_Bind_simple<std::_Mem_fn<void (gnash::media::MediaParser::*)()> (gnash::media::MediaParser*)>::operator()() /usr/include/c++/4.9.0/functional:1688 (libgnashmedia-0.8.11dev.so+0x0000000365f3)
    #10 std::thread::_Impl<std::_Bind_simple<std::_Mem_fn<void (gnash::media::MediaParser::*)()> (gnash::media::MediaParser*)> >::_M_run() /usr/include/c++/4.9.0/thread:115 (libgnashmedia-0.8.11dev.so+0x0000000365f3)
    #11 <null> <null>:0 (libstdc++.so.6+0x003af5ebae5f)

  Location is heap block of size 512 at 0x7d500000e400 allocated by main thread:
    #0 operator new(unsigned long) <null>:0 (libtsan.so.0+0x00000004cb42)
    #1 __gnu_cxx::new_allocator<std::unique_ptr<gnash::media::EncodedAudioFrame, std::default_delete<gnash::media::EncodedAudioFrame> > >::allocate(unsigned long, void const*) /usr/include/c++/4.9.0/ext/new_allocator.h:104 (libgnashmedia-0.8.11dev.so+0x000000033ae0)
    #2 std::_Deque_base<std::unique_ptr<gnash::media::EncodedAudioFrame, std::default_delete<gnash::media::EncodedAudioFrame> >, std::allocator<std::unique_ptr<gnash::media::EncodedAudioFrame, std::default_delete<gnash::media::EncodedAudioFrame> > > >::_M_allocate_node() /usr/include/c++/4.9.0/bits/stl_deque.h:538 (libgnashmedia-0.8.11dev.so+0x000000033ae0)
    #3 std::_Deque_base<std::unique_ptr<gnash::media::EncodedAudioFrame, std::default_delete<gnash::media::EncodedAudioFrame> >, std::allocator<std::unique_ptr<gnash::media::EncodedAudioFrame, std::default_delete<gnash::media::EncodedAudioFrame> > > >::_M_create_nodes(std::unique_ptr<gnash::media::EncodedAudioFrame, std::default_delete<gnash::media::EncodedAudioFrame> >**, std::unique_ptr<gnash::media::EncodedAudioFrame, std::default_delete<gnash::media::EncodedAudioFrame> >**) /usr/include/c++/4.9.0/bits/stl_deque.h:632 (libgnashmedia-0.8.11dev.so+0x000000033ae0)
    #4 std::_Deque_base<std::unique_ptr<gnash::media::EncodedAudioFrame, std::default_delete<gnash::media::EncodedAudioFrame> >, std::allocator<std::unique_ptr<gnash::media::EncodedAudioFrame, std::default_delete<gnash::media::EncodedAudioFrame> > > >::_M_initialize_map(unsigned long) /usr/include/c++/4.9.0/bits/stl_deque.h:606 (libgnashmedia-0.8.11dev.so+0x000000033ae0)
    #5 _Deque_base /usr/include/c++/4.9.0/bits/stl_deque.h:458 (libgnashmedia-0.8.11dev.so+0x000000033ae0)
    #6 deque /usr/include/c++/4.9.0/bits/stl_deque.h:788 (libgnashmedia-0.8.11dev.so+0x000000033ae0)
    #7 gnash::media::MediaParser::MediaParser(std::unique_ptr<gnash::IOChannel, std::default_delete<gnash::IOChannel> >) /home/bastiaan/gnash/libmedia/MediaParser.cpp:44 (libgnashmedia-0.8.11dev.so+0x000000033ae0)
    #8 gnash::media::FLVParser::FLVParser(std::unique_ptr<gnash::IOChannel, std::default_delete<gnash::IOChannel> >) /home/bastiaan/gnash/libmedia/FLVParser.cpp:52 (libgnashmedia-0.8.11dev.so+0x0000000246ee)
    #9 gnash::media::ffmpeg::MediaHandlerFfmpeg::createMediaParser(std::unique_ptr<gnash::IOChannel, std::default_delete<gnash::IOChannel> >) /home/bastiaan/gnash/libmedia/ffmpeg/MediaHandlerFfmpeg.cpp:60 (libgnashmedia-0.8.11dev.so+0x000000067e1b)
    #10 gnash::NetStream_as::startPlayback() /home/bastiaan/gnash/libcore/asobj/NetStream_as.cpp:503 (libgnashcore-0.8.11dev.so+0x0000002568c7)
    #11 gnash::NetStream_as::play(std::string const&) /home/bastiaan/gnash/libcore/asobj/NetStream_as.cpp:403 (libgnashcore-0.8.11dev.so+0x000000258e7e)
    #12 netstream_play /home/bastiaan/gnash/libcore/asobj/NetStream_as.cpp:1656 (libgnashcore-0.8.11dev.so+0x000000259251)
    #13 gnash::builtin_function::call(gnash::fn_call const&) /home/bastiaan/gnash/libcore/builtin_function.h:74 (libgnashcore-0.8.11dev.so+0x0000001e9ff7)
    #14 ActionCallMethod /home/bastiaan/gnash/libcore/vm/ASHandlers.cpp:2810 (libgnashcore-0.8.11dev.so+0x000000344312)
    #15 gnash::SWF::ActionHandler::execute(gnash::ActionExec&) const /home/bastiaan/gnash/libcore/vm/ASHandlers.cpp:238 (libgnashcore-0.8.11dev.so+0x00000032f469)
    #16 gnash::SWF::SWFHandlers::execute(gnash::SWF::ActionType, gnash::ActionExec&) const /home/bastiaan/gnash/libcore/vm/ASHandlers.cpp:431 (libgnashcore-0.8.11dev.so+0x000000347239)
    #17 gnash::ActionExec::operator()() /home/bastiaan/gnash/libcore/vm/ActionExec.cpp:258 (libgnashcore-0.8.11dev.so+0x00000034fba0)
    #18 gnash::SWF::ActionHandler::execute(gnash::ActionExec&) const /home/bastiaan/gnash/libcore/vm/ASHandlers.cpp:238 (libgnashcore-0.8.11dev.so+0x00000032f469)
    #19 gnash::SWF::SWFHandlers::execute(gnash::SWF::ActionType, gnash::ActionExec&) const /home/bastiaan/gnash/libcore/vm/ASHandlers.cpp:431 (libgnashcore-0.8.11dev.so+0x000000347239)
    #20 gnash::ActionExec::operator()() /home/bastiaan/gnash/libcore/vm/ActionExec.cpp:258 (libgnashcore-0.8.11dev.so+0x00000034fba0)
    #21 gnash::GlobalCode::execute() /home/bastiaan/gnash/libcore/vm/ExecutableCode.h:75 (libgnashcore-0.8.11dev.so+0x0000000f0750)
    #22 gnash::movie_root::processActionQueue(unsigned long) /home/bastiaan/gnash/libcore/movie_root.cpp:1403 (libgnashcore-0.8.11dev.so+0x0000000dcfd3)
    #23 gnash::movie_root::processActionQueue() /home/bastiaan/gnash/libcore/movie_root.cpp:1481 (libgnashcore-0.8.11dev.so+0x0000000dd279)
    #24 gnash::movie_root::advanceMovie() /home/bastiaan/gnash/libcore/movie_root.cpp:982 (libgnashcore-0.8.11dev.so+0x0000000dea4c)
    #25 gnash::movie_root::advance() /home/bastiaan/gnash/libcore/movie_root.cpp:933 (libgnashcore-0.8.11dev.so+0x0000000ee249)
    #26 play_movie /home/bastiaan/gnash/utilities/processor.cpp:532 (lt-gprocessor+0x000000009757)
    #27 main /home/bastiaan/gnash/utilities/processor.cpp:376 (lt-gprocessor+0x00000000b0e0)

Mutex M2191 created at:
    #0 pthread_mutex_lock <null>:0 (libtsan.so.0+0x00000003ae63)
    #1 __gthread_mutex_lock /usr/include/c++/4.9.0/x86_64-redhat-linux/bits/gthr-default.h:748 (libgnashmedia-0.8.11dev.so+0x0000000334c4)
    #2 std::mutex::lock() /usr/include/c++/4.9.0/mutex:134 (libgnashmedia-0.8.11dev.so+0x0000000334c4)
    #3 std::unique_lock<std::mutex>::lock() /usr/include/c++/4.9.0/mutex:473 (libgnashmedia-0.8.11dev.so+0x0000000334c4)
    #4 unique_lock /usr/include/c++/4.9.0/mutex:405 (libgnashmedia-0.8.11dev.so+0x0000000334c4)
    #5 gnash::media::MediaParser::parserLoop() /home/bastiaan/gnash/libmedia/MediaParser.cpp:419 (libgnashmedia-0.8.11dev.so+0x0000000334c4)
    #6 operator()<, void> /usr/include/c++/4.9.0/functional:569 (libgnashmedia-0.8.11dev.so+0x0000000365f3)
    #7 _M_invoke<0ul> /usr/include/c++/4.9.0/functional:1700 (libgnashmedia-0.8.11dev.so+0x0000000365f3)
    #8 std::_Bind_simple<std::_Mem_fn<void (gnash::media::MediaParser::*)()> (gnash::media::MediaParser*)>::operator()() /usr/include/c++/4.9.0/functional:1688 (libgnashmedia-0.8.11dev.so+0x0000000365f3)
    #9 std::thread::_Impl<std::_Bind_simple<std::_Mem_fn<void (gnash::media::MediaParser::*)()> (gnash::media::MediaParser*)> >::_M_run() /usr/include/c++/4.9.0/thread:115 (libgnashmedia-0.8.11dev.so+0x0000000365f3)
    #10 <null> <null>:0 (libstdc++.so.6+0x003af5ebae5f)

  Thread T3 (tid=3844, running) created by main thread at:
    #0 pthread_create <null>:0 (libtsan.so.0+0x00000004ac26)
    #1 std::thread::_M_start_thread(std::shared_ptr<std::thread::_Impl_base>) <null>:0 (libstdc++.so.6+0x003af5ebaf88)
    #2 gnash::media::FLVParser::FLVParser(std::unique_ptr<gnash::IOChannel, std::default_delete<gnash::IOChannel> >) /home/bastiaan/gnash/libmedia/FLVParser.cpp:58 (libgnashmedia-0.8.11dev.so+0x0000000248f9)
    #3 gnash::media::ffmpeg::MediaHandlerFfmpeg::createMediaParser(std::unique_ptr<gnash::IOChannel, std::default_delete<gnash::IOChannel> >) /home/bastiaan/gnash/libmedia/ffmpeg/MediaHandlerFfmpeg.cpp:60 (libgnashmedia-0.8.11dev.so+0x000000067e1b)
    #4 gnash::NetStream_as::startPlayback() /home/bastiaan/gnash/libcore/asobj/NetStream_as.cpp:503 (libgnashcore-0.8.11dev.so+0x0000002568c7)
    #5 gnash::NetStream_as::play(std::string const&) /home/bastiaan/gnash/libcore/asobj/NetStream_as.cpp:403 (libgnashcore-0.8.11dev.so+0x000000258e7e)
    #6 netstream_play /home/bastiaan/gnash/libcore/asobj/NetStream_as.cpp:1656 (libgnashcore-0.8.11dev.so+0x000000259251)
    #7 gnash::builtin_function::call(gnash::fn_call const&) /home/bastiaan/gnash/libcore/builtin_function.h:74 (libgnashcore-0.8.11dev.so+0x0000001e9ff7)
    #8 ActionCallMethod /home/bastiaan/gnash/libcore/vm/ASHandlers.cpp:2810 (libgnashcore-0.8.11dev.so+0x000000344312)
    #9 gnash::SWF::ActionHandler::execute(gnash::ActionExec&) const /home/bastiaan/gnash/libcore/vm/ASHandlers.cpp:238 (libgnashcore-0.8.11dev.so+0x00000032f469)
    #10 gnash::SWF::SWFHandlers::execute(gnash::SWF::ActionType, gnash::ActionExec&) const /home/bastiaan/gnash/libcore/vm/ASHandlers.cpp:431 (libgnashcore-0.8.11dev.so+0x000000347239)
    #11 gnash::ActionExec::operator()() /home/bastiaan/gnash/libcore/vm/ActionExec.cpp:258 (libgnashcore-0.8.11dev.so+0x00000034fba0)
    #12 gnash::SWF::ActionHandler::execute(gnash::ActionExec&) const /home/bastiaan/gnash/libcore/vm/ASHandlers.cpp:238 (libgnashcore-0.8.11dev.so+0x00000032f469)
    #13 gnash::SWF::SWFHandlers::execute(gnash::SWF::ActionType, gnash::ActionExec&) const /home/bastiaan/gnash/libcore/vm/ASHandlers.cpp:431 (libgnashcore-0.8.11dev.so+0x000000347239)
    #14 gnash::ActionExec::operator()() /home/bastiaan/gnash/libcore/vm/ActionExec.cpp:258 (libgnashcore-0.8.11dev.so+0x00000034fba0)
    #15 gnash::GlobalCode::execute() /home/bastiaan/gnash/libcore/vm/ExecutableCode.h:75 (libgnashcore-0.8.11dev.so+0x0000000f0750)
    #16 gnash::movie_root::processActionQueue(unsigned long) /home/bastiaan/gnash/libcore/movie_root.cpp:1403 (libgnashcore-0.8.11dev.so+0x0000000dcfd3)
    #17 gnash::movie_root::processActionQueue() /home/bastiaan/gnash/libcore/movie_root.cpp:1481 (libgnashcore-0.8.11dev.so+0x0000000dd279)
    #18 gnash::movie_root::advanceMovie() /home/bastiaan/gnash/libcore/movie_root.cpp:982 (libgnashcore-0.8.11dev.so+0x0000000dea4c)
    #19 gnash::movie_root::advance() /home/bastiaan/gnash/libcore/movie_root.cpp:933 (libgnashcore-0.8.11dev.so+0x0000000ee249)
    #21 main /home/bastiaan/gnash/utilities/processor.cpp:376 (lt-gprocessor+0x00000000b0e0)

SUMMARY: ThreadSanitizer: data race /usr/include/c++/4.9.0/bits/unique_ptr.h:328 std::unique_ptr<gnash::media::EncodedAudioFrame, std::default_delete<gnash::media::EncodedAudioFrame> >::release()

MediaParser::audioBufferLength() does not hold a lock. But this seems to be by design, as this function is called from MediaParser::getBufferLengthNoLock().

The problem seems to originate in FLVParser, at the following line:

 bool indexOnly = bufferFull(); // won't lock, but our caller locked...

So the comment seems to be incorrect.

Bastiaan Jacques <bjacques>
Project Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by bjacques (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

     

     

    No changes have been made to this item

    Back to the top


    Powered by Savane 3.5