================== WARNING: ThreadSanitizer: data race (pid=1744466) Atomic read of size 1 at 0x7b7c000000b0 by main thread: #0 pthread_mutex_lock ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:4165 (libtsan.so.0+0x526fc) #1 BloombergLP::bslmt::MutexImpl::lock() /opt/bb/include/bslmt_muteximpl_pthread.h:142 (ntf_test+0x13c55b) #2 BloombergLP::bslmt::Mutex::lock() /opt/bb/include/bslmt_mutex.h:349 (ntf_test+0x13c55b) #3 BloombergLP::bslmt::LockGuard::LockGuard(BloombergLP::bslmt::Mutex*) /opt/bb/include/bslmt_lockguard.h:410 (ntf_test+0x13c55b) #4 BloombergLP::ntcr::StreamSocket::close(BloombergLP::ntci::Callback const&) /home/mhenning/code/ntf-core/groups/ntc/ntcr/ntcr_streamsocket.cpp:5740 (ntf_test+0x13c55b) #5 main /home/mhenning/code/cpp/ts-gateway/test/ntf/ntf_test.cc:173 (ntf_test+0x666fe) Previous write of size 8 at 0x7b7c000000b0 by thread T2: #0 operator new(unsigned long) ../../../../src/libsanitizer/tsan/tsan_new_delete.cpp:64 (libtsan.so.0+0x8c032) #1 operator new(unsigned long, BloombergLP::bslma::Allocator&) /opt/bb/include/bslma_allocator.h:632 (ntf_test+0x147ef1) #2 void bsl::shared_ptr::createInplace&, bsl::shared_ptr&, bsl::shared_ptr&, bsl::shared_ptr&, BloombergLP::bslma::Allocator*&>(BloombergLP::bslma::Allocator*, BloombergLP::ntca::StreamSocketOptions&, bsl::shared_ptr&, bsl::shared_ptr&, bsl::shared_ptr&, bsl::shared_ptr&, BloombergLP::bslma::Allocator*&) /opt/bb/include/bslstl_sharedptr.h:4944 (ntf_test+0x147ef1) #3 BloombergLP::ntcr::Interface::createStreamSocket(BloombergLP::ntca::StreamSocketOptions const&, BloombergLP::bslma::Allocator*) /home/mhenning/code/ntf-core/groups/ntc/ntcr/ntcr_interface.cpp:809 (ntf_test+0x147ef1) #4 operator() /home/mhenning/code/cpp/ts-gateway/test/ntf/ntf_test.cc:121 (ntf_test+0x65bdd) #5 invoke /opt/bb/include/bslstl_function_invokerutil.h:927 (ntf_test+0x67098) #6 BloombergLP::bslstl::Function_Variadic::operator()() const /opt/bb/include/bslstl_function.h:1518 (ntf_test+0x1ff949) #7 BloombergLP::ntcs::Chronology::announce() /home/mhenning/code/ntf-core/groups/ntc/ntcs/ntcs_chronology.cpp:1157 (ntf_test+0x1ff949) As if synchronized via sleep: #0 sleep ../../../../src/libsanitizer/tsan/tsan_interceptors_posix.cpp:348 (libtsan.so.0+0x6314b) #1 main /home/mhenning/code/cpp/ts-gateway/test/ntf/ntf_test.cc:174 (ntf_test+0x666f2) Location is heap block of size 3152 at 0x7b7c00000000 allocated by thread T2: #0 operator new(unsigned long) ../../../../src/libsanitizer/tsan/tsan_new_delete.cpp:64 (libtsan.so.0+0x8c032) #1 operator new(unsigned long, BloombergLP::bslma::Allocator&) /opt/bb/include/bslma_allocator.h:632 (ntf_test+0x147ef1) #2 void bsl::shared_ptr::createInplace&, bsl::shared_ptr&, bsl::shared_ptr&, bsl::shared_ptr&, BloombergLP::bslma::Allocator*&>(BloombergLP::bslma::Allocator*, BloombergLP::ntca::StreamSocketOptions&, bsl::shared_ptr&, bsl::shared_ptr&, bsl::shared_ptr&, bsl::shared_ptr&, BloombergLP::bslma::Allocator*&) /opt/bb/include/bslstl_sharedptr.h:4944 (ntf_test+0x147ef1) #3 BloombergLP::ntcr::Interface::createStreamSocket(BloombergLP::ntca::StreamSocketOptions const&, BloombergLP::bslma::Allocator*) /home/mhenning/code/ntf-core/groups/ntc/ntcr/ntcr_interface.cpp:809 (ntf_test+0x147ef1) #4 operator() /home/mhenning/code/cpp/ts-gateway/test/ntf/ntf_test.cc:121 (ntf_test+0x65bdd) #5 invoke /opt/bb/include/bslstl_function_invokerutil.h:927 (ntf_test+0x67098) #6 BloombergLP::bslstl::Function_Variadic::operator()() const /opt/bb/include/bslstl_function.h:1518 (ntf_test+0x1ff949) #7 BloombergLP::ntcs::Chronology::announce() /home/mhenning/code/ntf-core/groups/ntc/ntcs/ntcs_chronology.cpp:1157 (ntf_test+0x1ff949) Thread T2 'interface-1-0' (tid=1744469, running) created by main thread at: #0 pthread_create ../../../../src/libsanitizer/tsan/tsan_interceptors_posix.cpp:962 (libtsan.so.0+0x5ea79) #1 BloombergLP::bslmt::ThreadUtilImpl::create(unsigned long*, BloombergLP::bslmt::ThreadAttributes const&, void* (*)(void*), void*) (ntf_test+0x2c1132) #2 main /home/mhenning/code/cpp/ts-gateway/test/ntf/ntf_test.cc:173 (ntf_test+0x666e8) SUMMARY: ThreadSanitizer: data race /opt/bb/include/bslmt_muteximpl_pthread.h:142 in BloombergLP::bslmt::MutexImpl::lock() ================== ThreadSanitizer: reported 1 warnings