-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Closed
Description
Describe the bug
Data race due to use of naked pointers.
To Reproduce
Thread sanitizer
Expected behavior
Clean run
Logs
WARNING: ThreadSanitizer: data race on vptr (ctor/dtor vs virtual call) (pid=69547)
Write of size 8 at 0x00010b11a730 by main thread:
#0 Poco::RefCountedObject::~RefCountedObject() RefCountedObject.cpp:27 (libPocoFoundationd.100.dylib:arm64+0x1a09f8)
#1 Poco::Notification::~Notification() Notification.cpp:29 (libPocoFoundationd.100.dylib:arm64+0x103b80)
#2 Poco::NewActionNotification::~NewActionNotification() ActiveThreadPool.cpp:37 (libPocoFoundationd.100.dylib:arm64+0x1b004)
#3 Poco::NewActionNotification::~NewActionNotification() ActiveThreadPool.cpp:37 (libPocoFoundationd.100.dylib:arm64+0x1ad78)
#4 Poco::NewActionNotification::~NewActionNotification() ActiveThreadPool.cpp:37 (libPocoFoundationd.100.dylib:arm64+0x1adc0)
#5 Poco::RefCountedObject::release() const RefCountedObject.h:82 (testrunnerd:arm64+0x100008908)
#6 Poco::AutoPtr<Poco::NewActionNotification>::~AutoPtr() AutoPtr.h:95 (libPocoFoundationd.100.dylib:arm64+0x1656c)
#7 Poco::ActiveThread::start(Poco::Thread::Priority, Poco::Runnable&) ActiveThreadPool.cpp:118 (libPocoFoundationd.100.dylib:arm64+0x162f0)
#8 Poco::ActiveThreadPool::start(Poco::Runnable&) ActiveThreadPool.cpp:255 (libPocoFoundationd.100.dylib:arm64+0x17cc0)
#9 Poco::ActiveStarter<Poco::AbstractEvent<int, Poco::FIFOStrategy<int, Poco::AbstractDelegate<int>>, Poco::AbstractDelegate<int>, Poco::FastMutex>>::start(Poco::AbstractEvent<int, Poco::FIFOStrategy<int, Poco::AbstractDelegate<int>>, Poco::AbstractDelegate<int>, Poco::FastMutex>*, Poco::AutoPtr<Poco::ActiveRunnableBase>) ActiveStarter.h:39 (testrunnerd:arm64+0x1002da8a4)
#10 CppUnit::TestRunner::run(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&, std::__1::function<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> (std::exception const&)> const&) TestRunner.cpp:142 (libCppUnitd.1.dylib:arm64+0x12668)
#11 main Driver.cpp:17 (testrunnerd:arm64+0x1000b4dac)
Previous read of size 8 at 0x00010b11a730 by thread T50:
#0 Poco::ActiveThread::run() ActiveThreadPool.cpp:166 (libPocoFoundationd.100.dylib:arm64+0x16c18)
#1 Poco::(anonymous namespace)::RunnableHolder::run() Thread.cpp:56 (libPocoFoundationd.100.dylib:arm64+0x1e8618)
#2 Poco::ThreadImpl::runnableEntry(void*) Thread_POSIX.cpp:407 (libPocoFoundationd.100.dylib:arm64+0x1e611c)
Location is heap block of size 48 at 0x00010b11a730 allocated by main thread:
#0 operator new(unsigned long) <null>:123127876 (libclang_rt.tsan_osx_dynamic.dylib:arm64e+0x83de0)
#1 Poco::AutoPtr<Poco::NewActionNotification> Poco::makeAuto<Poco::NewActionNotification, Poco::Thread::Priority&, Poco::Runnable&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>&>(Poco::Thread::Priority&, Poco::Runnable&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>&) AutoPtr.h:399 (libPocoFoundationd.100.dylib:arm64+0x163bc)
#2 Poco::ActiveThread::start(Poco::Thread::Priority, Poco::Runnable&) ActiveThreadPool.cpp:118 (libPocoFoundationd.100.dylib:arm64+0x162b8)
#3 Poco::ActiveThreadPool::start(Poco::Runnable&) ActiveThreadPool.cpp:255 (libPocoFoundationd.100.dylib:arm64+0x17cc0)
#4 Poco::ActiveStarter<Poco::AbstractEvent<int, Poco::FIFOStrategy<int, Poco::AbstractDelegate<int>>, Poco::AbstractDelegate<int>, Poco::FastMutex>>::start(Poco::AbstractEvent<int, Poco::FIFOStrategy<int, Poco::AbstractDelegate<int>>, Poco::AbstractDelegate<int>, Poco::FastMutex>*, Poco::AutoPtr<Poco::ActiveRunnableBase>) ActiveStarter.h:39 (testrunnerd:arm64+0x1002da8a4)
#5 CppUnit::TestRunner::run(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&, std::__1::function<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> (std::exception const&)> const&) TestRunner.cpp:142 (libCppUnitd.1.dylib:arm64+0x12668)
#6 main Driver.cpp:17 (testrunnerd:arm64+0x1000b4dac)
Please add relevant environment information:
osx, clang TSAN build
@bas524 this is a good contribution, but please - whenever possible, make use of smart pointers, there's a good reason why they exist. and run the code through sanitizers on multiple platforms/compilers
Reactions are currently unavailable