id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 3585,Boost::thread + valgrind/drd possible false positive,Mihail Strashun ,viboes,"OS: Arch Linux Boost Library v 1.39 Valgrind v 3.5 Problem description: Running small degenerated piece of code under valgrind/drd produces ""probably a race condition"" error on call of ""interrupt"". I was adviced on #boost channel to make a ticket after short examination of code. Note: This [ https://svn.boost.org/trac/boost/ticket/3526 ] case was added to valgrind suppression file. Example code attached. Compilation: {{{ make all Building file: ../src/test.cpp Invoking: GCC C++ Compiler g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF""src/test.d"" -MT""src/test.d"" -o""src/test.o"" ""../src/test.cpp"" Finished building: ../src/test.cpp Building target: test Invoking: GCC C++ Linker g++ -o""test"" ./src/test.o -lboost_thread-mt Finished building target: test }}} Output: {{{ [mist@fog test]$ valgrind --tool=drd ./Debug/test ==2759== drd, a thread error detector ==2759== Copyright (C) 2006-2009, and GNU GPL'd, by Bart Van Assche. ==2759== Using Valgrind-3.5.0 and LibVEX; rerun with -h for copyright info ==2759== Command: ./Debug/test ==2759== ==2759== Probably a race condition: condition variable 0x5f64180 has been signaled but the associated mutex 0x5f64158 is not locked by the signalling thread. ==2759== at 0x4C27BF9: pthread_cond_broadcast@* (in /usr/lib/valgrind/vgpreload_drd-amd64-linux.so) ==2759== by 0x4E3BC88: boost::thread::interrupt() (in /usr/lib/libboost_thread-mt.so.1.39.0) ==2759== by 0x405D42: stopThread(std::string const&) (test.cpp:45) ==2759== by 0x405E79: main (test.cpp:75) ==2759== cond 0x5f64180 was first observed at: ==2759== at 0x4C266D9: pthread_cond_init@* (in /usr/lib/valgrind/vgpreload_drd-amd64-linux.so) ==2759== by 0x406E0B: boost::condition_variable::condition_variable() (condition_variable_fwd.hpp:30) ==2759== by 0x406F39: boost::detail::thread_data_base::thread_data_base() (thread_data.hpp:54) ==2759== by 0x40BF1C: boost::detail::thread_data > > >::thread_data(boost::_bi::bind_t > >) (thread.hpp:48) ==2759== by 0x40B7F1: boost::detail::thread_data > > >* boost::detail::heap_new_impl > > >, boost::_bi::bind_t > >&>(boost::_bi::bind_t > >&) (thread_heap_alloc.hpp:47) ==2759== by 0x40AA8B: boost::detail::thread_data > > >* boost::detail::heap_new > > >, boost::_bi::bind_t > > >(boost::_bi::bind_t > >&) (thread_heap_alloc.hpp:73) ==2759== by 0x40A1C0: boost::shared_ptr boost::thread::make_thread_info > > >(boost::_bi::bind_t > >) (thread.hpp:136) ==2759== by 0x4092E1: boost::thread::thread(cTestRunner, std::string) (thread.hpp:227) ==2759== by 0x407D28: void startThread(std::string const&) (test.cpp:36) ==2759== by 0x405DDB: main (test.cpp:71) ==2759== mutex 0x5f64158 was first observed at: ==2759== at 0x4C2C04F: pthread_mutex_init (in /usr/lib/valgrind/vgpreload_drd-amd64-linux.so) ==2759== by 0x406D31: boost::mutex::mutex() (mutex.hpp:37) ==2759== by 0x406F27: boost::detail::thread_data_base::thread_data_base() (thread_data.hpp:54) ==2759== by 0x40BF1C: boost::detail::thread_data > > >::thread_data(boost::_bi::bind_t > >) (thread.hpp:48) ==2759== by 0x40B7F1: boost::detail::thread_data > > >* boost::detail::heap_new_impl > > >, boost::_bi::bind_t > >&>(boost::_bi::bind_t > >&) (thread_heap_alloc.hpp:47) ==2759== by 0x40AA8B: boost::detail::thread_data > > >* boost::detail::heap_new > > >, boost::_bi::bind_t > > >(boost::_bi::bind_t > >&) (thread_heap_alloc.hpp:73) ==2759== by 0x40A1C0: boost::shared_ptr boost::thread::make_thread_info > > >(boost::_bi::bind_t > >) (thread.hpp:136) ==2759== by 0x4092E1: boost::thread::thread(cTestRunner, std::string) (thread.hpp:227) ==2759== by 0x407D28: void startThread(std::string const&) (test.cpp:36) ==2759== by 0x405DDB: main (test.cpp:71) ==2759== ==2759== ==2759== For counts of detected and suppressed errors, rerun with: -v ==2759== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 1956 from 80) }}}",Bugs,closed,To Be Determined,thread,Boost 1.42.0,Problem,invalid,"thread, drd, valgrind",bvanassche@… viboes