Data race reported in Boost lockfree queue by TSan

355 views Asked by At

I'm running the MPMC example given in boost lockfree queue documentation with thread sanitizer and to my surprise this basic example contains data races as per TSan. Any idea what might be wrong?

OS: Red Hat Enterprise Linux Server release 7.7 / Ubuntu 18.04.4
Compiler: g++ (GCC) 9.3.1 20200408 (Red Hat 9.3.1-2) / g++ (Ubuntu 11.1.0-1ubuntu-18.04.1) 11.1.0
CPU Architecture: x86_64
Boost Version: 1.79

Output of TSan given below:

@vishal: g++ testQ.cpp -lboost_thread -L /usr/local/lib/ -pthread -fsanitize=thread -ggdb3 -fPIE -pie 

@vishal: TSAN_OPTIONS="history_size=7" ./a.out 

boost::lockfree::queue is lockfree
==================
WARNING: ThreadSanitizer: data race (pid=22019)
  Atomic write of size 8 at 0x7b1000001c00 by thread T1:
    #0 __tsan_atomic64_store <null> (libtsan.so.0+0x800ca)
    #1 std::atomic<boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int>::node> >::store(boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int>::node>, std::memory_order) /usr/include/c++/11/atomic:271 (a.out+0x110a3)
    #2 boost::lockfree::queue<int>::node::node(int const&, boost::lockfree::queue<int>::node*) /usr/local/include/boost/lockfree/queue.hpp:125 (a.out+0x12639)
    #3 boost::lockfree::queue<int>::node* boost::lockfree::detail::freelist_stack<boost::lockfree::queue<int>::node, boost::alignment::aligned_allocator<boost::lockfree::queue<int>::node, 64ul> >::construct<true, false, int, boost::lockfree::queue<int>::node*>(int const&, boost::lockfree::queue<int>::node* const&) /usr/local/include/boost/lockfree/detail/freelist.hpp:105 (a.out+0x11125)
    #4 bool boost::lockfree::queue<int>::do_push<false>(int const&) /usr/local/include/boost/lockfree/queue.hpp:326 (a.out+0xfdc4)
    #5 boost::lockfree::queue<int>::push(int const&) /usr/local/include/boost/lockfree/queue.hpp:304 (a.out+0xe5ab)
    #6 producer() /home/vishal/coding/c++/testQ.cpp:20 (a.out+0x5c3a)
    #7 boost::detail::thread_data<void (*)()>::run() /usr/local/include/boost/thread/detail/thread.hpp:120 (a.out+0x13c67)
    #8 thread_proxy <null> (libboost_thread.so.1.79.0+0xa646)

  Previous read of size 8 at 0x7b1000001c00 by thread T4:
    #0 boost::lockfree::detail::tagged_ptr<boost::lockfree::detail::freelist_stack<boost::lockfree::queue<int>::node, boost::alignment::aligned_allocator<boost::lockfree::queue<int>::node, 64ul> >::freelist_node>::extract_ptr(unsigned long const volatile&) /usr/local/include/boost/lockfree/detail/tagged_ptr_ptrcompression.hpp:44 (a.out+0x12470)
    #1 boost::lockfree::detail::tagged_ptr<boost::lockfree::detail::freelist_stack<boost::lockfree::queue<int>::node, boost::alignment::aligned_allocator<boost::lockfree::queue<int>::node, 64ul> >::freelist_node>::get_ptr() const /usr/local/include/boost/lockfree/detail/tagged_ptr_ptrcompression.hpp:115 (a.out+0x10f28)
    #2 boost::lockfree::queue<int>::node* boost::lockfree::detail::freelist_stack<boost::lockfree::queue<int>::node, boost::alignment::aligned_allocator<boost::lockfree::queue<int>::node, 64ul> >::allocate_impl<false>() /usr/local/include/boost/lockfree/detail/freelist.hpp:193 (a.out+0x12f7e)
    #3 boost::lockfree::queue<int>::node* boost::lockfree::detail::freelist_stack<boost::lockfree::queue<int>::node, boost::alignment::aligned_allocator<boost::lockfree::queue<int>::node, 64ul> >::allocate<true, false>() /usr/local/include/boost/lockfree/detail/freelist.hpp:171 (a.out+0x124ba)
    #4 boost::lockfree::queue<int>::node* boost::lockfree::detail::freelist_stack<boost::lockfree::queue<int>::node, boost::alignment::aligned_allocator<boost::lockfree::queue<int>::node, 64ul> >::construct<true, false, int, boost::lockfree::queue<int>::node*>(int const&, boost::lockfree::queue<int>::node* const&) /usr/local/include/boost/lockfree/detail/freelist.hpp:103 (a.out+0x110e4)
    #5 bool boost::lockfree::queue<int>::do_push<false>(int const&) /usr/local/include/boost/lockfree/queue.hpp:326 (a.out+0xfdc4)
    #6 boost::lockfree::queue<int>::push(int const&) /usr/local/include/boost/lockfree/queue.hpp:304 (a.out+0xe5ab)
    #7 producer() /home/vishal/coding/c++/testQ.cpp:20 (a.out+0x5c3a)
    #8 boost::detail::thread_data<void (*)()>::run() /usr/local/include/boost/thread/detail/thread.hpp:120 (a.out+0x13c67)
    #9 thread_proxy <null> (libboost_thread.so.1.79.0+0xa646)

  Location is heap block of size 64 at 0x7b1000001c00 allocated by main thread:
    #0 posix_memalign <null> (libtsan.so.0+0x31add)
    #1 boost::alignment::aligned_alloc(unsigned long, unsigned long) /usr/local/include/boost/align/detail/aligned_alloc_posix.hpp:26 (a.out+0xcd82)
    #2 boost::alignment::aligned_allocator<boost::lockfree::queue<int>::node, 64ul>::allocate(unsigned long, void const*) /usr/local/include/boost/align/aligned_allocator.hpp:70 (a.out+0x10d62)
    #3 boost::lockfree::detail::freelist_stack<boost::lockfree::queue<int>::node, boost::alignment::aligned_allocator<boost::lockfree::queue<int>::node, 64ul> >::freelist_stack<boost::alignment::aligned_allocator<boost::lockfree::queue<int>::node, 64ul> >(boost::alignment::aligned_allocator<boost::lockfree::queue<int>::node, 64ul> const&, unsigned long) /usr/local/include/boost/lockfree/detail/freelist.hpp:62 (a.out+0xfb20)
    #4 boost::lockfree::queue<int>::queue(unsigned long) /usr/local/include/boost/lockfree/queue.hpp:234 (a.out+0xe525)
    #5 __static_initialization_and_destruction_0 /home/vishal/coding/c++/testQ.cpp:10 (a.out+0x68af)
    #6 _GLOBAL__sub_I_producer_count /home/vishal/coding/c++/testQ.cpp:61 (a.out+0x6911)
    #7 __libc_csu_init <null> (a.out+0x1470c)

  Thread T1 (tid=22021, running) created by main thread at:
    #0 pthread_create <null> (libtsan.so.0+0x5fe84)
    #1 boost::thread::start_thread_noexcept() <null> (libboost_thread.so.1.79.0+0x98cc)
    #2 boost::thread::thread<void (*&)()>(void (*&)()) /usr/local/include/boost/thread/detail/thread.hpp:269 (a.out+0x102d9)
    #3 boost::thread* boost::thread_group::create_thread<void (*)()>(void (*)()) /usr/local/include/boost/thread/detail/thread_group.hpp:79 (a.out+0xe6f2)
    #4 main /home/vishal/coding/c++/testQ.cpp:49 (a.out+0x620e)

  Thread T4 (tid=22024, running) created by main thread at:
    #0 pthread_create <null> (libtsan.so.0+0x5fe84)
    #1 boost::thread::start_thread_noexcept() <null> (libboost_thread.so.1.79.0+0x98cc)
    #2 boost::thread::thread<void (*&)()>(void (*&)()) /usr/local/include/boost/thread/detail/thread.hpp:269 (a.out+0x102d9)
    #3 boost::thread* boost::thread_group::create_thread<void (*)()>(void (*)()) /usr/local/include/boost/thread/detail/thread_group.hpp:79 (a.out+0xe6f2)
    #4 main /home/vishal/coding/c++/testQ.cpp:49 (a.out+0x620e)

SUMMARY: ThreadSanitizer: data race (/usr/lib/x86_64-linux-gnu/libtsan.so.0+0x800ca) in __tsan_atomic64_store
==================
==================
WARNING: ThreadSanitizer: data race (pid=22019)
  Read of size 8 at 0x7b100000f400 by thread T2:
    #0 boost::lockfree::detail::tagged_ptr<boost::lockfree::detail::freelist_stack<boost::lockfree::queue<int>::node, boost::alignment::aligned_allocator<boost::lockfree::queue<int>::node, 64ul> >::freelist_node>::extract_ptr(unsigned long const volatile&) /usr/local/include/boost/lockfree/detail/tagged_ptr_ptrcompression.hpp:44 (a.out+0x12470)
    #1 boost::lockfree::detail::tagged_ptr<boost::lockfree::detail::freelist_stack<boost::lockfree::queue<int>::node, boost::alignment::aligned_allocator<boost::lockfree::queue<int>::node, 64ul> >::freelist_node>::get_ptr() const /usr/local/include/boost/lockfree/detail/tagged_ptr_ptrcompression.hpp:115 (a.out+0x10f28)
    #2 boost::lockfree::queue<int>::node* boost::lockfree::detail::freelist_stack<boost::lockfree::queue<int>::node, boost::alignment::aligned_allocator<boost::lockfree::queue<int>::node, 64ul> >::allocate_impl<false>() /usr/local/include/boost/lockfree/detail/freelist.hpp:193 (a.out+0x12f7e)
    #3 boost::lockfree::queue<int>::node* boost::lockfree::detail::freelist_stack<boost::lockfree::queue<int>::node, boost::alignment::aligned_allocator<boost::lockfree::queue<int>::node, 64ul> >::allocate<true, false>() /usr/local/include/boost/lockfree/detail/freelist.hpp:171 (a.out+0x124ba)
    #4 boost::lockfree::queue<int>::node* boost::lockfree::detail::freelist_stack<boost::lockfree::queue<int>::node, boost::alignment::aligned_allocator<boost::lockfree::queue<int>::node, 64ul> >::construct<true, false, int, boost::lockfree::queue<int>::node*>(int const&, boost::lockfree::queue<int>::node* const&) /usr/local/include/boost/lockfree/detail/freelist.hpp:103 (a.out+0x110e4)
    #5 bool boost::lockfree::queue<int>::do_push<false>(int const&) /usr/local/include/boost/lockfree/queue.hpp:326 (a.out+0xfdc4)
    #6 boost::lockfree::queue<int>::push(int const&) /usr/local/include/boost/lockfree/queue.hpp:304 (a.out+0xe5ab)
    #7 producer() /home/vishal/coding/c++/testQ.cpp:20 (a.out+0x5c3a)
    #8 boost::detail::thread_data<void (*)()>::run() /usr/local/include/boost/thread/detail/thread.hpp:120 (a.out+0x13c67)
    #9 thread_proxy <null> (libboost_thread.so.1.79.0+0xa646)

  Previous atomic write of size 8 at 0x7b100000f400 by thread T4:
    #0 __tsan_atomic64_compare_exchange_strong <null> (libtsan.so.0+0x8608d)
    #1 std::atomic<boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int>::node> >::compare_exchange_weak(boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int>::node>&, boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int>::node>, std::memory_order, std::memory_order) /usr/include/c++/11/atomic:323 (a.out+0x1276a)
    #2 std::atomic<boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int>::node> >::compare_exchange_weak(boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int>::node>&, boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int>::node>, std::memory_order) /usr/include/c++/11/atomic:342 (a.out+0x11347)
    #3 bool boost::lockfree::queue<int>::do_push<false>(int const&) /usr/local/include/boost/lockfree/queue.hpp:342 (a.out+0xfee4)
    #4 boost::lockfree::queue<int>::push(int const&) /usr/local/include/boost/lockfree/queue.hpp:304 (a.out+0xe5ab)
    #5 producer() /home/vishal/coding/c++/testQ.cpp:20 (a.out+0x5c3a)
    #6 boost::detail::thread_data<void (*)()>::run() /usr/local/include/boost/thread/detail/thread.hpp:120 (a.out+0x13c67)
    #7 thread_proxy <null> (libboost_thread.so.1.79.0+0xa646)

  Location is heap block of size 64 at 0x7b100000f400 allocated by thread T2:
    #0 posix_memalign <null> (libtsan.so.0+0x31add)
    #1 boost::alignment::aligned_alloc(unsigned long, unsigned long) /usr/local/include/boost/align/detail/aligned_alloc_posix.hpp:26 (a.out+0xcd82)
    #2 boost::alignment::aligned_allocator<boost::lockfree::queue<int>::node, 64ul>::allocate(unsigned long, void const*) /usr/local/include/boost/align/aligned_allocator.hpp:70 (a.out+0x10d62)
    #3 boost::lockfree::queue<int>::node* boost::lockfree::detail::freelist_stack<boost::lockfree::queue<int>::node, boost::alignment::aligned_allocator<boost::lockfree::queue<int>::node, 64ul> >::allocate_impl<false>() /usr/local/include/boost/lockfree/detail/freelist.hpp:185 (a.out+0x12f4a)
    #4 boost::lockfree::queue<int>::node* boost::lockfree::detail::freelist_stack<boost::lockfree::queue<int>::node, boost::alignment::aligned_allocator<boost::lockfree::queue<int>::node, 64ul> >::allocate<true, false>() /usr/local/include/boost/lockfree/detail/freelist.hpp:171 (a.out+0x124ba)
    #5 boost::lockfree::queue<int>::node* boost::lockfree::detail::freelist_stack<boost::lockfree::queue<int>::node, boost::alignment::aligned_allocator<boost::lockfree::queue<int>::node, 64ul> >::construct<true, false, int, boost::lockfree::queue<int>::node*>(int const&, boost::lockfree::queue<int>::node* const&) /usr/local/include/boost/lockfree/detail/freelist.hpp:103 (a.out+0x110e4)
    #6 bool boost::lockfree::queue<int>::do_push<false>(int const&) /usr/local/include/boost/lockfree/queue.hpp:326 (a.out+0xfdc4)
    #7 boost::lockfree::queue<int>::push(int const&) /usr/local/include/boost/lockfree/queue.hpp:304 (a.out+0xe5ab)
    #8 producer() /home/vishal/coding/c++/testQ.cpp:20 (a.out+0x5c3a)
    #9 boost::detail::thread_data<void (*)()>::run() /usr/local/include/boost/thread/detail/thread.hpp:120 (a.out+0x13c67)
    #10 thread_proxy <null> (libboost_thread.so.1.79.0+0xa646)

  Thread T2 (tid=22022, running) created by main thread at:
    #0 pthread_create <null> (libtsan.so.0+0x5fe84)
    #1 boost::thread::start_thread_noexcept() <null> (libboost_thread.so.1.79.0+0x98cc)
    #2 boost::thread::thread<void (*&)()>(void (*&)()) /usr/local/include/boost/thread/detail/thread.hpp:269 (a.out+0x102d9)
    #3 boost::thread* boost::thread_group::create_thread<void (*)()>(void (*)()) /usr/local/include/boost/thread/detail/thread_group.hpp:79 (a.out+0xe6f2)
    #4 main /home/vishal/coding/c++/testQ.cpp:49 (a.out+0x620e)

  Thread T4 (tid=22024, running) created by main thread at:
    #0 pthread_create <null> (libtsan.so.0+0x5fe84)
    #1 boost::thread::start_thread_noexcept() <null> (libboost_thread.so.1.79.0+0x98cc)
    #2 boost::thread::thread<void (*&)()>(void (*&)()) /usr/local/include/boost/thread/detail/thread.hpp:269 (a.out+0x102d9)
    #3 boost::thread* boost::thread_group::create_thread<void (*)()>(void (*)()) /usr/local/include/boost/thread/detail/thread_group.hpp:79 (a.out+0xe6f2)
    #4 main /home/vishal/coding/c++/testQ.cpp:49 (a.out+0x620e)

SUMMARY: ThreadSanitizer: data race /usr/local/include/boost/lockfree/detail/tagged_ptr_ptrcompression.hpp:44 in boost::lockfree::detail::tagged_ptr<boost::lockfree::detail::freelist_stack<boost::lockfree::queue<int>::node, boost::alignment::aligned_allocator<boost::lockfree::queue<int>::node, 64ul> >::freelist_node>::extract_ptr(unsigned long const volatile&)
==================
==================
WARNING: ThreadSanitizer: data race (pid=22019)
  Write of size 8 at 0x7b1000051c00 by thread T6:
    #0 boost::lockfree::detail::tagged_ptr<boost::lockfree::detail::freelist_stack<boost::lockfree::queue<int>::node, boost::alignment::aligned_allocator<boost::lockfree::queue<int>::node, 64ul> >::freelist_node>::set_ptr(boost::lockfree::detail::freelist_stack<boost::lockfree::queue<int>::node, boost::alignment::aligned_allocator<boost::lockfree::queue<int>::node, 64ul> >::freelist_node*) /usr/local/include/boost/lockfree/detail/tagged_ptr_ptrcompression.hpp:121 (a.out+0x12dfb)
    #1 boost::lockfree::detail::freelist_stack<boost::lockfree::queue<int>::node, boost::alignment::aligned_allocator<boost::lockfree::queue<int>::node, 64ul> >::deallocate_impl(boost::lockfree::queue<int>::node*) /usr/local/include/boost/lockfree/detail/freelist.hpp:245 (a.out+0x12304)
    #2 void boost::lockfree::detail::freelist_stack<boost::lockfree::queue<int>::node, boost::alignment::aligned_allocator<boost::lockfree::queue<int>::node, 64ul> >::deallocate<true>(boost::lockfree::queue<int>::node*) /usr/local/include/boost/lockfree/detail/freelist.hpp:231 (a.out+0x12895)
    #3 void boost::lockfree::detail::freelist_stack<boost::lockfree::queue<int>::node, boost::alignment::aligned_allocator<boost::lockfree::queue<int>::node, 64ul> >::destruct<true>(boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int>::node> const&) /usr/local/include/boost/lockfree/detail/freelist.hpp:114 (a.out+0x1147f)
    #4 bool boost::lockfree::queue<int>::pop<int>(int&) /usr/local/include/boost/lockfree/queue.hpp:442 (a.out+0x101fa)
    #5 boost::lockfree::queue<int>::pop(int&) /usr/local/include/boost/lockfree/queue.hpp:399 (a.out+0xe601)
    #6 consumer() /home/vishal/coding/c++/testQ.cpp:30 (a.out+0x5e48)
    #7 boost::detail::thread_data<void (*)()>::run() /usr/local/include/boost/thread/detail/thread.hpp:120 (a.out+0x13c67)
    #8 thread_proxy <null> (libboost_thread.so.1.79.0+0xa646)

  Previous atomic read of size 8 at 0x7b1000051c00 by thread T5:
    #0 __tsan_atomic64_load <null> (libtsan.so.0+0x7f4ea)
    #1 std::atomic<boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int>::node> >::load(std::memory_order) const /usr/include/c++/11/atomic:285 (a.out+0x111b1)
    #2 bool boost::lockfree::queue<int>::pop<int>(int&) /usr/local/include/boost/lockfree/queue.hpp:418 (a.out+0x10054)
    #3 boost::lockfree::queue<int>::pop(int&) /usr/local/include/boost/lockfree/queue.hpp:399 (a.out+0xe601)
    #4 consumer() /home/vishal/coding/c++/testQ.cpp:30 (a.out+0x5e48)
    #5 boost::detail::thread_data<void (*)()>::run() /usr/local/include/boost/thread/detail/thread.hpp:120 (a.out+0x13c67)
    #6 thread_proxy <null> (libboost_thread.so.1.79.0+0xa646)

  Location is heap block of size 64 at 0x7b1000051c00 allocated by thread T1:
    #0 posix_memalign <null> (libtsan.so.0+0x31add)
    #1 boost::alignment::aligned_alloc(unsigned long, unsigned long) /usr/local/include/boost/align/detail/aligned_alloc_posix.hpp:26 (a.out+0xcd82)
    #2 boost::alignment::aligned_allocator<boost::lockfree::queue<int>::node, 64ul>::allocate(unsigned long, void const*) /usr/local/include/boost/align/aligned_allocator.hpp:70 (a.out+0x10d62)
    #3 boost::lockfree::queue<int>::node* boost::lockfree::detail::freelist_stack<boost::lockfree::queue<int>::node, boost::alignment::aligned_allocator<boost::lockfree::queue<int>::node, 64ul> >::allocate_impl<false>() /usr/local/include/boost/lockfree/detail/freelist.hpp:185 (a.out+0x12f4a)
    #4 boost::lockfree::queue<int>::node* boost::lockfree::detail::freelist_stack<boost::lockfree::queue<int>::node, boost::alignment::aligned_allocator<boost::lockfree::queue<int>::node, 64ul> >::allocate<true, false>() /usr/local/include/boost/lockfree/detail/freelist.hpp:171 (a.out+0x124ba)
    #5 boost::lockfree::queue<int>::node* boost::lockfree::detail::freelist_stack<boost::lockfree::queue<int>::node, boost::alignment::aligned_allocator<boost::lockfree::queue<int>::node, 64ul> >::construct<true, false, int, boost::lockfree::queue<int>::node*>(int const&, boost::lockfree::queue<int>::node* const&) /usr/local/include/boost/lockfree/detail/freelist.hpp:103 (a.out+0x110e4)
    #6 bool boost::lockfree::queue<int>::do_push<false>(int const&) /usr/local/include/boost/lockfree/queue.hpp:326 (a.out+0xfdc4)
    #7 boost::lockfree::queue<int>::push(int const&) /usr/local/include/boost/lockfree/queue.hpp:304 (a.out+0xe5ab)
    #8 producer() /home/vishal/coding/c++/testQ.cpp:20 (a.out+0x5c3a)
    #9 boost::detail::thread_data<void (*)()>::run() /usr/local/include/boost/thread/detail/thread.hpp:120 (a.out+0x13c67)
    #10 thread_proxy <null> (libboost_thread.so.1.79.0+0xa646)

  Thread T6 (tid=22026, running) created by main thread at:
    #0 pthread_create <null> (libtsan.so.0+0x5fe84)
    #1 boost::thread::start_thread_noexcept() <null> (libboost_thread.so.1.79.0+0x98cc)
    #2 boost::thread::thread<void (*&)()>(void (*&)()) /usr/local/include/boost/thread/detail/thread.hpp:269 (a.out+0x102d9)
    #3 boost::thread* boost::thread_group::create_thread<void (*)()>(void (*)()) /usr/local/include/boost/thread/detail/thread_group.hpp:79 (a.out+0xe6f2)
    #4 main /home/vishal/coding/c++/testQ.cpp:52 (a.out+0x6243)

  Thread T5 (tid=22025, running) created by main thread at:
    #0 pthread_create <null> (libtsan.so.0+0x5fe84)
    #1 boost::thread::start_thread_noexcept() <null> (libboost_thread.so.1.79.0+0x98cc)
    #2 boost::thread::thread<void (*&)()>(void (*&)()) /usr/local/include/boost/thread/detail/thread.hpp:269 (a.out+0x102d9)
    #3 boost::thread* boost::thread_group::create_thread<void (*)()>(void (*)()) /usr/local/include/boost/thread/detail/thread_group.hpp:79 (a.out+0xe6f2)
    #4 main /home/vishal/coding/c++/testQ.cpp:52 (a.out+0x6243)

  Thread T1 (tid=22021, running) created by main thread at:
    #0 pthread_create <null> (libtsan.so.0+0x5fe84)
    #1 boost::thread::start_thread_noexcept() <null> (libboost_thread.so.1.79.0+0x98cc)
    #2 boost::thread::thread<void (*&)()>(void (*&)()) /usr/local/include/boost/thread/detail/thread.hpp:269 (a.out+0x102d9)
    #3 boost::thread* boost::thread_group::create_thread<void (*)()>(void (*)()) /usr/local/include/boost/thread/detail/thread_group.hpp:79 (a.out+0xe6f2)
    #4 main /home/vishal/coding/c++/testQ.cpp:49 (a.out+0x620e)

SUMMARY: ThreadSanitizer: data race /usr/local/include/boost/lockfree/detail/tagged_ptr_ptrcompression.hpp:121 in boost::lockfree::detail::tagged_ptr<boost::lockfree::detail::freelist_stack<boost::lockfree::queue<int>::node, boost::alignment::aligned_allocator<boost::lockfree::queue<int>::node, 64ul> >::freelist_node>::set_ptr(boost::lockfree::detail::freelist_stack<boost::lockfree::queue<int>::node, boost::alignment::aligned_allocator<boost::lockfree::queue<int>::node, 64ul> >::freelist_node*)
==================
==================
WARNING: ThreadSanitizer: data race (pid=22019)
  Write of size 4 at 0x7b1000051f88 by thread T3:
    #0 boost::lockfree::queue<int>::node::node(int const&, boost::lockfree::queue<int>::node*) /usr/local/include/boost/lockfree/queue.hpp:120 (a.out+0x125e3)
    #1 boost::lockfree::queue<int>::node* boost::lockfree::detail::freelist_stack<boost::lockfree::queue<int>::node, boost::alignment::aligned_allocator<boost::lockfree::queue<int>::node, 64ul> >::construct<true, false, int, boost::lockfree::queue<int>::node*>(int const&, boost::lockfree::queue<int>::node* const&) /usr/local/include/boost/lockfree/detail/freelist.hpp:105 (a.out+0x11125)
    #2 bool boost::lockfree::queue<int>::do_push<false>(int const&) /usr/local/include/boost/lockfree/queue.hpp:326 (a.out+0xfdc4)
    #3 boost::lockfree::queue<int>::push(int const&) /usr/local/include/boost/lockfree/queue.hpp:304 (a.out+0xe5ab)
    #4 producer() /home/vishal/coding/c++/testQ.cpp:20 (a.out+0x5c3a)
    #5 boost::detail::thread_data<void (*)()>::run() /usr/local/include/boost/thread/detail/thread.hpp:120 (a.out+0x13c67)
    #6 thread_proxy <null> (libboost_thread.so.1.79.0+0xa646)

  Previous read of size 4 at 0x7b1000051f88 by thread T8:
    #0 void boost::lockfree::detail::copy_convertible::copy<int, int>(int&, int&) /usr/local/include/boost/lockfree/detail/copy_payload.hpp:29 (a.out+0x12840)
    #1 void boost::lockfree::detail::copy_payload<int, int>(int&, int&) /usr/local/include/boost/lockfree/detail/copy_payload.hpp:49 (a.out+0x11437)
    #2 bool boost::lockfree::queue<int>::pop<int>(int&) /usr/local/include/boost/lockfree/queue.hpp:438 (a.out+0x10182)
    #3 boost::lockfree::queue<int>::pop(int&) /usr/local/include/boost/lockfree/queue.hpp:399 (a.out+0xe601)
    #4 consumer() /home/vishal/coding/c++/testQ.cpp:30 (a.out+0x5e48)
    #5 boost::detail::thread_data<void (*)()>::run() /usr/local/include/boost/thread/detail/thread.hpp:120 (a.out+0x13c67)
    #6 thread_proxy <null> (libboost_thread.so.1.79.0+0xa646)

  Location is heap block of size 64 at 0x7b1000051f80 allocated by thread T1:
    #0 posix_memalign <null> (libtsan.so.0+0x31add)
    #1 boost::alignment::aligned_alloc(unsigned long, unsigned long) /usr/local/include/boost/align/detail/aligned_alloc_posix.hpp:26 (a.out+0xcd82)
    #2 boost::alignment::aligned_allocator<boost::lockfree::queue<int>::node, 64ul>::allocate(unsigned long, void const*) /usr/local/include/boost/align/aligned_allocator.hpp:70 (a.out+0x10d62)
    #3 boost::lockfree::queue<int>::node* boost::lockfree::detail::freelist_stack<boost::lockfree::queue<int>::node, boost::alignment::aligned_allocator<boost::lockfree::queue<int>::node, 64ul> >::allocate_impl<false>() /usr/local/include/boost/lockfree/detail/freelist.hpp:185 (a.out+0x12f4a)
    #4 boost::lockfree::queue<int>::node* boost::lockfree::detail::freelist_stack<boost::lockfree::queue<int>::node, boost::alignment::aligned_allocator<boost::lockfree::queue<int>::node, 64ul> >::allocate<true, false>() /usr/local/include/boost/lockfree/detail/freelist.hpp:171 (a.out+0x124ba)
    #5 boost::lockfree::queue<int>::node* boost::lockfree::detail::freelist_stack<boost::lockfree::queue<int>::node, boost::alignment::aligned_allocator<boost::lockfree::queue<int>::node, 64ul> >::construct<true, false, int, boost::lockfree::queue<int>::node*>(int const&, boost::lockfree::queue<int>::node* const&) /usr/local/include/boost/lockfree/detail/freelist.hpp:103 (a.out+0x110e4)
    #6 bool boost::lockfree::queue<int>::do_push<false>(int const&) /usr/local/include/boost/lockfree/queue.hpp:326 (a.out+0xfdc4)
    #7 boost::lockfree::queue<int>::push(int const&) /usr/local/include/boost/lockfree/queue.hpp:304 (a.out+0xe5ab)
    #8 producer() /home/vishal/coding/c++/testQ.cpp:20 (a.out+0x5c3a)
    #9 boost::detail::thread_data<void (*)()>::run() /usr/local/include/boost/thread/detail/thread.hpp:120 (a.out+0x13c67)
    #10 thread_proxy <null> (libboost_thread.so.1.79.0+0xa646)

  Thread T3 (tid=22023, running) created by main thread at:
    #0 pthread_create <null> (libtsan.so.0+0x5fe84)
    #1 boost::thread::start_thread_noexcept() <null> (libboost_thread.so.1.79.0+0x98cc)
    #2 boost::thread::thread<void (*&)()>(void (*&)()) /usr/local/include/boost/thread/detail/thread.hpp:269 (a.out+0x102d9)
    #3 boost::thread* boost::thread_group::create_thread<void (*)()>(void (*)()) /usr/local/include/boost/thread/detail/thread_group.hpp:79 (a.out+0xe6f2)
    #4 main /home/vishal/coding/c++/testQ.cpp:49 (a.out+0x620e)

  Thread T8 (tid=22028, running) created by main thread at:
    #0 pthread_create <null> (libtsan.so.0+0x5fe84)
    #1 boost::thread::start_thread_noexcept() <null> (libboost_thread.so.1.79.0+0x98cc)
    #2 boost::thread::thread<void (*&)()>(void (*&)()) /usr/local/include/boost/thread/detail/thread.hpp:269 (a.out+0x102d9)
    #3 boost::thread* boost::thread_group::create_thread<void (*)()>(void (*)()) /usr/local/include/boost/thread/detail/thread_group.hpp:79 (a.out+0xe6f2)
    #4 main /home/vishal/coding/c++/testQ.cpp:52 (a.out+0x6243)

  Thread T1 (tid=22021, running) created by main thread at:
    #0 pthread_create <null> (libtsan.so.0+0x5fe84)
    #1 boost::thread::start_thread_noexcept() <null> (libboost_thread.so.1.79.0+0x98cc)
    #2 boost::thread::thread<void (*&)()>(void (*&)()) /usr/local/include/boost/thread/detail/thread.hpp:269 (a.out+0x102d9)
    #3 boost::thread* boost::thread_group::create_thread<void (*)()>(void (*)()) /usr/local/include/boost/thread/detail/thread_group.hpp:79 (a.out+0xe6f2)
    #4 main /home/vishal/coding/c++/testQ.cpp:49 (a.out+0x620e)

SUMMARY: ThreadSanitizer: data race /usr/local/include/boost/lockfree/queue.hpp:120 in boost::lockfree::queue<int>::node::node(int const&, boost::lockfree::queue<int>::node*)
==================
0

There are 0 answers