in version 1.3.1, any data race warnings reported in runtime when compile with "-fsanitize=thread -fsanitize-recover=all"
I compile the websocket server and client sample with the flag "-fsanitize=thread -fsanitize-recover=all", when start them, there will report any data race warning by sanitizer(https://github.com/google/sanitizers/wiki/), some likes below :
==================
WARNING: ThreadSanitizer: data race (pid=13948)
Write of size 8 at 0x7b38000000f8 by main thread:
#0 hv::EventLoop::stop()
Previous read of size 8 at 0x7b38000000f8 by thread T2:
#0 hv::EventLoop::tid()
As if synchronized via sleep: #0 nanosleep ../../../../src/libsanitizer/tsan/tsan_interceptors_posix.cpp:366 (libtsan.so.0+0x6696c) #1 void std::this_thread::sleep_for<long, std::ratio<1l, 1000l> >(std::chrono::duration<long, std::ratio<1l, 1000l> > const&) /usr/include/c++/11/bits/this_thread_sleep.h:82 (worker+0xa842b) #2 main ******/enter.cpp:260 (worker+0xa0462)
Location is heap block of size 216 at 0x7b38000000e0 allocated by main thread: #0 operator new(unsigned long) ../../../../src/libsanitizer/tsan/tsan_new_delete.cpp:64 (libtsan.so.0+0x8f162) #1 __gnu_cxx::new_allocator<std::_Sp_counted_ptr_inplace<hv::EventLoop, std::allocatorhv::EventLoop, (__gnu_cxx::_Lock_policy)2> >::allocate(unsigned long, void const*) /usr/include/c++/11/ext/new_allocator.h:127 (libhv.so+0x1f4ff5) #2 main ******/enter.cpp:127 (worker+0x9f3bb)
Thread T2 (tid=13958, finished) created by main thread at:
#0 pthread_create ../../../../src/libsanitizer/tsan/tsan_interceptors_posix.cpp:969 (libtsan.so.0+0x605b8)
#1 std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_deletestd::thread::_State >, void (*)())
SUMMARY: ThreadSanitizer: data race (******/worker+0xa2be0) in hv::EventLoop::stop()
==================
WARNING: ThreadSanitizer: data race (pid=13947)
Write of size 8 at 0x7b38000000f8 by main thread:
#0 hv::EventLoop::stop()
Previous read of size 8 at 0x7b38000000f8 by thread T2:
#0 hv::EventLoop::tid()
As if synchronized via sleep: #0 nanosleep ../../../../src/libsanitizer/tsan/tsan_interceptors_posix.cpp:366 (libtsan.so.0+0x6696c) #1 void std::this_thread::sleep_for<long, std::ratio<1l, 1000l> >(std::chrono::duration<long, std::ratio<1l, 1000l> > const&) /usr/include/c++/11/bits/this_thread_sleep.h:82 (worker+0xa842b) #2 main ******/enter.cpp:260 (worker+0xa0462)
Location is heap block of size 216 at 0x7b38000000e0 allocated by main thread: #0 operator new(unsigned long) ../../../../src/libsanitizer/tsan/tsan_new_delete.cpp:64 (libtsan.so.0+0x8f162) #1 __gnu_cxx::new_allocator<std::_Sp_counted_ptr_inplace<hv::EventLoop, std::allocatorhv::EventLoop, (__gnu_cxx::_Lock_policy)2> >::allocate(unsigned long, void const*) /usr/include/c++/11/ext/new_allocator.h:127 (libhv.so+0x1f4ff5) #2 main ******/enter.cpp:127 (worker+0x9f3bb)
Thread T2 (tid=13955, running) created by main thread at:
#0 pthread_create ../../../../src/libsanitizer/tsan/tsan_interceptors_posix.cpp:969 (libtsan.so.0+0x605b8)
#1 std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_deletestd::thread::_State >, void (*)())
SUMMARY: ThreadSanitizer: data race (/home/user/work/project/presetup/ai-clinical-presetup/bin/worker+0xa2be0) in hv::EventLoop::stop()
==================
WARNING: ThreadSanitizer: data race (pid=13949)
Write of size 8 at 0x7b38000000f8 by main thread:
#0 hv::EventLoop::stop()
Previous read of size 8 at 0x7b38000000f8 by thread T2:
#0 hv::EventLoop::tid()
As if synchronized via sleep: #0 nanosleep ../../../../src/libsanitizer/tsan/tsan_interceptors_posix.cpp:366 (libtsan.so.0+0x6696c) #1 void std::this_thread::sleep_for<long, std::ratio<1l, 1000l> >(std::chrono::duration<long, std::ratio<1l, 1000l> > const&) /usr/include/c++/11/bits/this_thread_sleep.h:82 (worker+0xa842b) #2 main ******/enter.cpp:260 (worker+0xa0462)
Location is heap block of size 216 at 0x7b38000000e0 allocated by main thread: #0 operator new(unsigned long) ../../../../src/libsanitizer/tsan/tsan_new_delete.cpp:64 (libtsan.so.0+0x8f162) #1 __gnu_cxx::new_allocator<std::_Sp_counted_ptr_inplace<hv::EventLoop, std::allocatorhv::EventLoop, (__gnu_cxx::_Lock_policy)2> >::allocate(unsigned long, void const*) /usr/include/c++/11/ext/new_allocator.h:127 (libhv.so+0x1f4ff5) #2 main ******/enter.cpp:127 (worker+0x9f3bb)
Thread T2 (tid=13961, finished) created by main thread at:
#0 pthread_create ../../../../src/libsanitizer/tsan/tsan_interceptors_posix.cpp:969 (libtsan.so.0+0x605b8)
#1 std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_deletestd::thread::_State >, void (*)())
SUMMARY: ThreadSanitizer: data race (/home/user/work/project/presetup/ai-clinical-presetup/bin/worker+0xa2be0) in hv::EventLoop::stop()
ThreadSanitizer: reported 1 warnings ThreadSanitizer: reported 1 warnings ThreadSanitizer: reported 1 warnings