bugGnash - The GNU Flash player - Bugs: bug #42548, data race to...

 
 

bug #42548: data race to sound_handler::_inputStreams

Submitted by:  Bastiaan Jacques <bjacques>
Submitted on:  Fri 13 Jun 2014 09:15:41 AM UTC  
 
Category:  sound 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 09:15:41 AM UTC, original submission:  

Threa sanitizer shows, when playing gangsta_rap_se.swf:

==================
WARNING: ThreadSanitizer: data race (pid=24027)
  Read of size 8 at 0x7d380000deb8 by main thread:
    #0 std::_Rb_tree<gnash::sound::InputStream*, gnash::sound::InputStream*, std::_Identity<gnash::sound::InputStream*>, std::less<gnash::sound::InputStream*>, std::allocator<gnash::sound::InputStream*> >::empty() const /usr/include/c++/4.9.0/bits/stl_tree.h:768 (libgnashsound-0.8.11dev.so+0x000000016e01)
    #1 std::set<gnash::sound::InputStream*, std::less<gnash::sound::InputStream*>, std::allocator<gnash::sound::InputStream*> >::empty() const /usr/include/c++/4.9.0/bits/stl_set.h:405 (libgnashsound-0.8.11dev.so+0x000000016e01)
    #2 gnash::sound::sound_handler::streamingSound() const /home/bastiaan/gnash/libsound/sound_handler.cpp:646 (libgnashsound-0.8.11dev.so+0x000000016e01)
    #3 gnash::movie_root::advance() /home/bastiaan/gnash/libcore/movie_root.cpp:864 (libgnashcore-0.8.11dev.so+0x0000000edb74)
    #4 gnash::Gui::advanceMovie(bool) /home/bastiaan/gnash/gui/gui.cpp:954 (lt-gtk-gnash+0x00000004519b)
    #5 gnash::Gui::advance_movie(gnash::Gui*) /home/bastiaan/gnash/gui/gui.h:273 (lt-gtk-gnash+0x00000006b3ba)
    #6 <null> <null>:0 (libglib-2.0.so.0+0x003e80849e42)
    #7 gnash::Player::run(int, char**, std::string const&, std::string const&) /home/bastiaan/gnash/gui/Player.cpp:664 (lt-gtk-gnash+0x000000053ae4)
    #8 playFile(gnash::Player&, int, char**, std::string const&) /home/bastiaan/gnash/gui/gnash.cpp:92 (lt-gtk-gnash+0x000000017a27)
    #9 __call<void, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, 0ul, 1ul, 2ul, 3ul> /usr/include/c++/4.9.0/functional:1264 (lt-gtk-gnash+0x00000001bb40)
    #10 operator()<std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, void> /usr/include/c++/4.9.0/functional:1323 (lt-gtk-gnash+0x00000001bb40)
    #11 for_each<__gnu_cxx::__normal_iterator<std::basic_string<char>*, std::vector<std::basic_string<char> > >, std::_Bind<void (*(std::reference_wrapper<gnash::Player>, int, char**, std::_Placeholder<1>))(gnash::Player&, int, char**, const std::basic_string<char>&)> > /usr/include/c++/4.9.0/bits/stl_algo.h:3755 (lt-gtk-gnash+0x00000001bb40)
    #12 main /home/bastiaan/gnash/gui/gnash.cpp:176 (lt-gtk-gnash+0x00000001bb40)

  Previous write of size 8 at 0x7d380000deb8 by thread T5 (mutexes: write M301385, write M986):
    #0 std::_Rb_tree<gnash::sound::InputStream*, gnash::sound::InputStream*, std::_Identity<gnash::sound::InputStream*>, std::less<gnash::sound::InputStream*>, std::allocator<gnash::sound::InputStream*> >::_M_erase_aux(std::_Rb_tree_const_iterator<gnash::sound::InputStream*>) /usr/include/c++/4.9.0/bits/stl_tree.h:1868 (libgnashsound-0.8.11dev.so+0x00000001b986)
    #1 std::_Rb_tree<gnash::sound::InputStream*, gnash::sound::InputStream*, std::_Identity<gnash::sound::InputStream*>, std::less<gnash::sound::InputStream*>, std::allocator<gnash::sound::InputStream*> >::erase[abi:cxx11](std::_Rb_tree_const_iterator<gnash::sound::InputStream*>) /usr/include/c++/4.9.0/bits/stl_tree.h:857 (libgnashsound-0.8.11dev.so+0x00000001b986)
    #2 std::_Rb_tree<gnash::sound::InputStream*, gnash::sound::InputStream*, std::_Identity<gnash::sound::InputStream*>, std::less<gnash::sound::InputStream*>, std::allocator<gnash::sound::InputStream*> >::_M_erase_aux(std::_Rb_tree_const_iterator<gnash::sound::InputStream*>, std::_Rb_tree_const_iterator<gnash::sound::InputStream*>) /usr/include/c++/4.9.0/bits/stl_tree.h:1881 (libgnashsound-0.8.11dev.so+0x00000001b986)
    #3 std::_Rb_tree<gnash::sound::InputStream*, gnash::sound::InputStream*, std::_Identity<gnash::sound::InputStream*>, std::less<gnash::sound::InputStream*>, std::allocator<gnash::sound::InputStream*> >::erase[abi:cxx11](std::_Rb_tree_const_iterator<gnash::sound::InputStream*>, std::_Rb_tree_const_iterator<gnash::sound::InputStream*>) /usr/include/c++/4.9.0/bits/stl_tree.h:890 (libgnashsound-0.8.11dev.so+0x00000001b986)
    #4 std::_Rb_tree<gnash::sound::InputStream*, gnash::sound::InputStream*, std::_Identity<gnash::sound::InputStream*>, std::less<gnash::sound::InputStream*>, std::allocator<gnash::sound::InputStream*> >::erase(gnash::sound::InputStream* const&) /usr/include/c++/4.9.0/bits/stl_tree.h:1892 (libgnashsound-0.8.11dev.so+0x00000001b986)
    #5 std::set<gnash::sound::InputStream*, std::less<gnash::sound::InputStream*>, std::allocator<gnash::sound::InputStream*> >::erase(gnash::sound::InputStream* const&) /usr/include/c++/4.9.0/bits/stl_set.h:621 (libgnashsound-0.8.11dev.so+0x00000001aba2)
    #6 gnash::sound::sound_handler::unplugCompletedInputStreams() /home/bastiaan/gnash/libsound/sound_handler.cpp:682 (libgnashsound-0.8.11dev.so+0x00000001aba2)
    #7 gnash::sound::sound_handler::fetchSamples(short*, unsigned int) /home/bastiaan/gnash/libsound/sound_handler.cpp:607 (libgnashsound-0.8.11dev.so+0x00000001b37b)
    #8 gnash::sound::SDL_sound_handler::fetchSamples(short*, unsigned int) /home/bastiaan/gnash/libsound/sdl/sound_handler_sdl.cpp:243 (libgnashsound-0.8.11dev.so+0x000000023f72)
    #9 gnash::sound::SDL_sound_handler::sdl_audio_callback(void*, unsigned char*, int) /home/bastiaan/gnash/libsound/sdl/sound_handler_sdl.cpp:282 (libgnashsound-0.8.11dev.so+0x000000025214)
    #10 <null> <null>:0 (libSDL-1.2.so.0+0x003fb9e08f98)

  Location is heap block of size 224 at 0x7d380000de40 allocated by main thread:
    #0 operator new(unsigned long) <null>:0 (libtsan.so.0+0x00000004cb42)
    #1 gnash::sound::create_sound_handler_sdl(gnash::media::MediaHandler*) /home/bastiaan/gnash/libsound/sdl/sound_handler_sdl.cpp:236 (libgnashsound-0.8.11dev.so+0x000000024744)
    #2 gnash::Player::init_sound() /home/bastiaan/gnash/gui/Player.cpp:279 (lt-gtk-gnash+0x00000005005c)
    #3 gnash::Player::run(int, char**, std::string const&, std::string const&) /home/bastiaan/gnash/gui/Player.cpp:449 (lt-gtk-gnash+0x000000052126)
    #4 playFile(gnash::Player&, int, char**, std::string const&) /home/bastiaan/gnash/gui/gnash.cpp:92 (lt-gtk-gnash+0x000000017a27)
    #5 __call<void, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, 0ul, 1ul, 2ul, 3ul> /usr/include/c++/4.9.0/functional:1264 (lt-gtk-gnash+0x00000001bb40)
    #6 operator()<std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, void> /usr/include/c++/4.9.0/functional:1323 (lt-gtk-gnash+0x00000001bb40)
    #7 for_each<__gnu_cxx::__normal_iterator<std::basic_string<char>*, std::vector<std::basic_string<char> > >, std::_Bind<void (*(std::reference_wrapper<gnash::Player>, int, char**, std::_Placeholder<1>))(gnash::Player&, int, char**, const std::basic_string<char>&)> > /usr/include/c++/4.9.0/bits/stl_algo.h:3755 (lt-gtk-gnash+0x00000001bb40)
    #8 main /home/bastiaan/gnash/gui/gnash.cpp:176 (lt-gtk-gnash+0x00000001bb40)

  Mutex M301385 created at:
    #0 pthread_mutex_init <null>:0 (libtsan.so.0+0x00000004a8b8)
    #1 SDL_CreateMutex <null>:0 (libSDL-1.2.so.0+0x003fb9e551cc)
    #2 gnash::sound::SDL_sound_handler::plugInputStream(std::unique_ptr<gnash::sound::InputStream, std::default_delete<gnash::sound::InputStream> >) /home/bastiaan/gnash/libsound/sdl/sound_handler_sdl.cpp:309 (libgnashsound-0.8.11dev.so+0x000000024821)
    #3 gnash::sound::sound_handler::startSound(int, int, std::vector<gnash::sound::SoundEnvelope, std::allocator<gnash::sound::SoundEnvelope> > const*, bool, unsigned int, unsigned int) /home/bastiaan/gnash/libsound/sound_handler.cpp:529 (libgnashsound-0.8.11dev.so+0x00000001a9da)
    #4 gnash::SWF::StartSoundTag::executeActions(gnash::MovieClip*, gnash::DisplayList&) const /home/bastiaan/gnash/libcore/swf/StartSoundTag.cpp:103 (libgnashcore-0.8.11dev.so+0x00000016012d)
    #5 gnash::MovieClip::executeFrameTags(unsigned long, gnash::DisplayList&, int) /home/bastiaan/gnash/libcore/MovieClip.cpp:1059 (libgnashcore-0.8.11dev.so+0x00000010bbac)
    #6 gnash::MovieClip::goto_frame(unsigned long) /home/bastiaan/gnash/libcore/MovieClip.cpp:1167 (libgnashcore-0.8.11dev.so+0x00000010e857)
    #7 ActionGotoFrame /home/bastiaan/gnash/libcore/vm/ASHandlers.cpp:558 (libgnashcore-0.8.11dev.so+0x00000033fd4a)
    #8 gnash::SWF::ActionHandler::execute(gnash::ActionExec&) const /home/bastiaan/gnash/libcore/vm/ASHandlers.cpp:238 (libgnashcore-0.8.11dev.so+0x00000032f469)
    #9 gnash::SWF::SWFHandlers::execute(gnash::SWF::ActionType, gnash::ActionExec&) const /home/bastiaan/gnash/libcore/vm/ASHandlers.cpp:431 (libgnashcore-0.8.11dev.so+0x000000347239)
    #10 gnash::ActionExec::operator()() /home/bastiaan/gnash/libcore/vm/ActionExec.cpp:258 (libgnashcore-0.8.11dev.so+0x00000034fba0)
    #11 gnash::GlobalCode::execute() /home/bastiaan/gnash/libcore/vm/ExecutableCode.h:75 (libgnashcore-0.8.11dev.so+0x0000000f0750)
    #12 gnash::movie_root::processActionQueue(unsigned long) /home/bastiaan/gnash/libcore/movie_root.cpp:1403 (libgnashcore-0.8.11dev.so+0x0000000dcfd3)
    #13 gnash::movie_root::processActionQueue() /home/bastiaan/gnash/libcore/movie_root.cpp:1481 (libgnashcore-0.8.11dev.so+0x0000000dd279)
    #14 gnash::movie_root::advanceMovie() /home/bastiaan/gnash/libcore/movie_root.cpp:982 (libgnashcore-0.8.11dev.so+0x0000000dea4c)
    #15 gnash::movie_root::advance() /home/bastiaan/gnash/libcore/movie_root.cpp:933 (libgnashcore-0.8.11dev.so+0x0000000ee249)
    #16 gnash::Gui::advanceMovie(bool) /home/bastiaan/gnash/gui/gui.cpp:954 (lt-gtk-gnash+0x00000004519b)
    #17 gnash::Gui::advance_movie(gnash::Gui*) /home/bastiaan/gnash/gui/gui.h:273 (lt-gtk-gnash+0x00000006b3ba)
    #18 <null> <null>:0 (libglib-2.0.so.0+0x003e80849e42)
    #19 gnash::Player::run(int, char**, std::string const&, std::string const&) /home/bastiaan/gnash/gui/Player.cpp:664 (lt-gtk-gnash+0x000000053ae4)
    #20 playFile(gnash::Player&, int, char**, std::string const&) /home/bastiaan/gnash/gui/gnash.cpp:92 (lt-gtk-gnash+0x000000017a27)
    #21 __call<void, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, 0ul, 1ul, 2ul, 3ul> /usr/include/c++/4.9.0/functional:1264 (lt-gtk-gnash+0x00000001bb40)
    #22 operator()<std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, void> /usr/include/c++/4.9.0/functional:1323 (lt-gtk-gnash+0x00000001bb40)
    #23 for_each<__gnu_cxx::__normal_iterator<std::basic_string<char>*, std::vector<std::basic_string<char> > >, std::_Bind<void (*(std::reference_wrapper<gnash::Player>, int, char**, std::_Placeholder<1>))(gnash::Player&, int, char**, const std::basic_string<char>&)> > /usr/include/c++/4.9.0/bits/stl_algo.h:3755 (lt-gtk-gnash+0x00000001bb40)
    #24 main /home/bastiaan/gnash/gui/gnash.cpp:176 (lt-gtk-gnash+0x00000001bb40)

  Mutex M986 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 (libgnashsound-0.8.11dev.so+0x000000023bf8)
    #2 std::mutex::lock() /usr/include/c++/4.9.0/mutex:134 (libgnashsound-0.8.11dev.so+0x000000023bf8)
    #3 lock_guard /usr/include/c++/4.9.0/mutex:376 (libgnashsound-0.8.11dev.so+0x000000023bf8)
    #4 gnash::sound::SDL_sound_handler::createStreamingSound(gnash::media::SoundInfo const&) /home/bastiaan/gnash/libsound/sdl/sound_handler_sdl.cpp:138 (libgnashsound-0.8.11dev.so+0x000000023bf8)
    #5 gnash::SWF::SoundStreamHeadTag::loader(gnash::SWFStream&, gnash::SWF::TagType, gnash::movie_definition&, gnash::RunResources const&) /home/bastiaan/gnash/libcore/swf/SoundStreamHeadTag.cpp:159 (libgnashcore-0.8.11dev.so+0x00000015ff6f)
    #6 gnash::SWFParser::read(long) /home/bastiaan/gnash/libcore/parser/SWFParser.cpp:96 (libgnashcore-0.8.11dev.so+0x00000031835e)
    #7 gnash::SWFMovieDefinition::read_all_swf() /home/bastiaan/gnash/libcore/parser/SWFMovieDefinition.cpp:467 (libgnashcore-0.8.11dev.so+0x000000324895)
    #8 operator()<, void> /usr/include/c++/4.9.0/functional:569 (libgnashcore-0.8.11dev.so+0x0000003271ad)
    #9 _M_invoke<0ul> /usr/include/c++/4.9.0/functional:1700 (libgnashcore-0.8.11dev.so+0x0000003271ad)
    #10 std::_Bind_simple<std::_Mem_fn<void (gnash::SWFMovieDefinition::*)()> (gnash::SWFMovieDefinition*)>::operator()() /usr/include/c++/4.9.0/functional:1688 (libgnashcore-0.8.11dev.so+0x0000003271ad)
    #11 std::thread::_Impl<std::_Bind_simple<std::_Mem_fn<void (gnash::SWFMovieDefinition::*)()> (gnash::SWFMovieDefinition*)> >::_M_run() /usr/include/c++/4.9.0/thread:115 (libgnashcore-0.8.11dev.so+0x0000003271ad)
    #12 <null> <null>:0 (libstdc++.so.6+0x003af5ebae5f)

  Thread T5 (tid=24035, running) created by main thread at:
    #0 pthread_create <null>:0 (libtsan.so.0+0x00000004ac26)
    #1 <null> <null>:0 (libSDL-1.2.so.0+0x003fb9e54d4a)
    #2 gnash::sound::SDL_sound_handler::plugInputStream(std::unique_ptr<gnash::sound::InputStream, std::default_delete<gnash::sound::InputStream> >) /home/bastiaan/gnash/libsound/sdl/sound_handler_sdl.cpp:309 (libgnashsound-0.8.11dev.so+0x000000024821)
    #3 gnash::sound::sound_handler::startSound(int, int, std::vector<gnash::sound::SoundEnvelope, std::allocator<gnash::sound::SoundEnvelope> > const*, bool, unsigned int, unsigned int) /home/bastiaan/gnash/libsound/sound_handler.cpp:529 (libgnashsound-0.8.11dev.so+0x00000001a9da)
    #4 gnash::SWF::StartSoundTag::executeActions(gnash::MovieClip*, gnash::DisplayList&) const /home/bastiaan/gnash/libcore/swf/StartSoundTag.cpp:103 (libgnashcore-0.8.11dev.so+0x00000016012d)
    #5 gnash::MovieClip::executeFrameTags(unsigned long, gnash::DisplayList&, int) /home/bastiaan/gnash/libcore/MovieClip.cpp:1059 (libgnashcore-0.8.11dev.so+0x00000010bbac)
    #6 gnash::MovieClip::goto_frame(unsigned long) /home/bastiaan/gnash/libcore/MovieClip.cpp:1167 (libgnashcore-0.8.11dev.so+0x00000010e857)
    #7 ActionGotoFrame /home/bastiaan/gnash/libcore/vm/ASHandlers.cpp:558 (libgnashcore-0.8.11dev.so+0x00000033fd4a)
    #8 gnash::SWF::ActionHandler::execute(gnash::ActionExec&) const /home/bastiaan/gnash/libcore/vm/ASHandlers.cpp:238 (libgnashcore-0.8.11dev.so+0x00000032f469)
    #9 gnash::SWF::SWFHandlers::execute(gnash::SWF::ActionType, gnash::ActionExec&) const /home/bastiaan/gnash/libcore/vm/ASHandlers.cpp:431 (libgnashcore-0.8.11dev.so+0x000000347239)
    #10 gnash::ActionExec::operator()() /home/bastiaan/gnash/libcore/vm/ActionExec.cpp:258 (libgnashcore-0.8.11dev.so+0x00000034fba0)
    #11 gnash::GlobalCode::execute() /home/bastiaan/gnash/libcore/vm/ExecutableCode.h:75 (libgnashcore-0.8.11dev.so+0x0000000f0750)
    #12 gnash::movie_root::processActionQueue(unsigned long) /home/bastiaan/gnash/libcore/movie_root.cpp:1403 (libgnashcore-0.8.11dev.so+0x0000000dcfd3)
    #13 gnash::movie_root::processActionQueue() /home/bastiaan/gnash/libcore/movie_root.cpp:1481 (libgnashcore-0.8.11dev.so+0x0000000dd279)
    #14 gnash::movie_root::advanceMovie() /home/bastiaan/gnash/libcore/movie_root.cpp:982 (libgnashcore-0.8.11dev.so+0x0000000dea4c)
    #15 gnash::movie_root::advance() /home/bastiaan/gnash/libcore/movie_root.cpp:933 (libgnashcore-0.8.11dev.so+0x0000000ee249)
    #16 gnash::Gui::advanceMovie(bool) /home/bastiaan/gnash/gui/gui.cpp:954 (lt-gtk-gnash+0x00000004519b)
    #17 gnash::Gui::advance_movie(gnash::Gui*) /home/bastiaan/gnash/gui/gui.h:273 (lt-gtk-gnash+0x00000006b3ba)
    #18 <null> <null>:0 (libglib-2.0.so.0+0x003e80849e42)
    #19 gnash::Player::run(int, char**, std::string const&, std::string const&) /home/bastiaan/gnash/gui/Player.cpp:664 (lt-gtk-gnash+0x000000053ae4)
    #20 playFile(gnash::Player&, int, char**, std::string const&) /home/bastiaan/gnash/gui/gnash.cpp:92 (lt-gtk-gnash+0x000000017a27)
    #21 __call<void, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, 0ul, 1ul, 2ul, 3ul> /usr/include/c++/4.9.0/functional:1264 (lt-gtk-gnash+0x00000001bb40)
    #22 operator()<std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, void> /usr/include/c++/4.9.0/functional:1323 (lt-gtk-gnash+0x00000001bb40)
    #23 for_each<__gnu_cxx::__normal_iterator<std::basic_string<char>*, std::vector<std::basic_string<char> > >, std::_Bind<void (*(std::reference_wrapper<gnash::Player>, int, char**, std::_Placeholder<1>))(gnash::Player&, int, char**, const std::basic_string<char>&)> > /usr/include/c++/4.9.0/bits/stl_algo.h:3755 (lt-gtk-gnash+0x00000001bb40)
    #24 main /home/bastiaan/gnash/gui/gnash.cpp:176 (lt-gtk-gnash+0x00000001bb40)

SUMMARY: ThreadSanitizer: data race /usr/include/c++/4.9.0/bits/stl_tree.h:768 std::_Rb_tree<gnash::sound::InputStream*, gnash::sound::InputStream*, std::_Identity<gnash::sound::InputStream*>, std::less<gnash::sound::InputStream*>, std::allocator<gnash::sound::InputStream*> >::empty() const
==================

It seems two threads are accessing sound_handler::_inputStreams at the same time. sound_handler_sdl, from its own thread, is holding a mutex lock in SDL_sound_handler::fetchSamples(), but the main thread does not hold a lock when calling sound_handler::streamingSound().

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