Helgrind causing data race warning in mutex_destroy_WRK?

"Schmidt, Adriaan" <[email protected]>
Newsgroups gmane.comp.debugging.valgrind
Message-ID <PAXPR10MB4828716D9D9783073C8B2206EDFE9@PAXPR10MB4828.EURPRD10.PROD.OUTLOOK.COM>
Hi.

Running Helgrind (Valgrind 3.17.0) on arm32 (Linux 4.14.139), glibc 2.31, and an application using Poco 1.10.1, I see the following:

==17922== Possible data race during read of size 1 at 0x64BD4C4 by thread #97
==17922== Locks held: 1, at address 0x1C134CC
==17922==    at 0x48536D8: my_memcmp (hg_intercepts.c:220)
==17922==    by 0x4853BBF: mutex_destroy_WRK (hg_intercepts.c:859)
==17922==    by 0x48572F7: pthread_mutex_destroy (hg_intercepts.c:882)
==17922==    by 0x5705F23: Poco::EventImpl::~EventImpl() (Event_POSIX.cpp:96)
==17922==    by 0x5706393: Poco::Event::~Event() (Event.cpp:40)
==17922==    by 0x578099B: Poco::Timer::~Timer() (Timer.cpp:34)
==17922==    by 0x5470827: Poco::Data::SessionPool::~SessionPool() (SessionPool.cpp:40)
==17922==    by 0x54708A7: Poco::Data::SessionPool::~SessionPool() (SessionPool.cpp:50)
==.....==    [ ... ]
==17922== 
==17922== This conflicts with a previous write of size 4 by thread #7
==17922== Locks held: none
==17922==    at 0x57F8998: __pthread_mutex_unlock_usercnt (pthread_mutex_unlock.c:52)
==17922==    by 0x4854273: mutex_unlock_WRK (hg_intercepts.c:1106)
==17922==    by 0x4857337: pthread_mutex_unlock (hg_intercepts.c:1124)
==17922==    by 0x5781153: setImpl (Event_POSIX.h:61)
==17922==    by 0x5781153: set (Event.h:101)
==17922==    by 0x5781153: Poco::Timer::run() (Timer.cpp:216)
==17922==    by 0x577ACAF: Poco::PooledThread::run() (ThreadPool.cpp:199)
==17922==    by 0x57765B3: Poco::ThreadImpl::runnableEntry(void*) (Thread_POSIX.cpp:345)
==17922==    by 0x48562FF: mythread_wrapper (hg_intercepts.c:398)
==17922==    by 0x57F4143: start_thread (pthread_create.c:477)

To me it seems that Helgrind itself is causing the warning when calculating mutex_is_init (hg_intercepts.c:859).

The conflicting access is a write to the field __data.__owner of the mutex (https://elixir.bootlin.com/glibc/glibc-2.31/source/nptl/pthread_mutex_unlock.c#L52).

Any ideas what could be going on here?

Thanks,
Adriaan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.