Bug 446081

Summary: DRD/Helgrind with C++11 std::condition_variable::wait_until, several issues
Product: [Developer tools] valgrind Reporter: Paul Floyd <pjfloyd>
Component: drdAssignee: Bart Van Assche <bart.vanassche+kde>
Status: RESOLVED NOT A BUG    
Severity: normal    
Priority: NOR    
Version First Reported In: 3.19 GIT   
Target Milestone: ---   
Platform: Other   
OS: All   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: helgrind/freebsd
drd/freebsd
helgrind/linux
drd/linux

Description Paul Floyd 2021-11-25 15:40:13 UTC
Created attachment 143936 [details]
helgrind/freebsd

I was looking fort examples that exercise the new pthread_clock APIS. The template code is a bit hard to read between the templates and conditional compilation but it seems to me that

std::timed_mutex (and timed_recursive_mutex) may use pthread_mutex_clocklock
std::shared_timed_mutex may use pthread_rwlock_clockwrlock and pthread_rwlock_clockrdlock

I started with this example https://en.cppreference.com/w/cpp/thread/condition_variable/wait_until
(need to check that it really is using some of the above functions. It generates several errors with both helgrind and drd.

I also need to try
https://en.cppreference.com/w/cpp/thread/shared_timed_mutex/try_lock_until
and
https://en.cppreference.com/w/cpp/thread/timed_mutex/try_lock_until

There seems to be a fair bit going wrong here. For comparison here are logs from FreeBSD (which I know has other issues, but the cv.wait_until used the timed rather than the clock version).
Comment 1 Paul Floyd 2021-11-25 15:40:30 UTC
Created attachment 143937 [details]
drd/freebsd
Comment 2 Paul Floyd 2021-11-25 16:35:27 UTC
Hmm. This test does use 'timed' rather than 'clock'. I'll carry on trying to debug it.
Comment 3 Paul Floyd 2021-11-25 16:35:54 UTC
Created attachment 143939 [details]
helgrind/linux
Comment 4 Paul Floyd 2021-11-25 16:36:12 UTC
Created attachment 143940 [details]
drd/linux
Comment 5 Paul Floyd 2021-11-26 21:16:02 UTC
This doesn't produce the errors that I was expecting. Though there are numerous errors I'll close it and deal with them separately.