https://bugs.kde.org/show_bug.cgi?id=392331

            Bug ID: 392331
           Summary: Spurious lock not held error from inside
                    pthread_cond_timedwait
           Product: valgrind
           Version: 3.13.0
          Platform: Gentoo Packages
                OS: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: NOR
         Component: helgrind
          Assignee: jsew...@acm.org
          Reporter: faminebad...@googlemail.com
  Target Milestone: ---

I'm getting the following error from my program:

 ==18784== Thread #4: pthread_cond_{signal,broadcast}: dubious: associated lock
is not held by any thread
 ==18784==    at 0x4C335B1: pthread_cond_signal_WRK (hg_intercepts.c:1384)
 ==18784==    by 0x5CFBC3D: pthread_cond_timedwait@@GLIBC_2.3.2 (in
/lib64/libpthread-2.26.so)
 ==18784==    by 0x4C36F54: pthread_cond_timedwait_WRK.constprop.1
(hg_intercepts.c:1295)
 ==18784==    by 0x110F6C: semaphore_wait (semaphores.c:113)
 ==18784==    by 0x10C983: exchange_thread (exchange_thread.c:337)
 ==18784==    by 0x4C316A6: mythread_wrapper (hg_intercepts.c:389)
 ==18784==    by 0x5CF48E9: start_thread (in /lib64/libpthread-2.26.so)
 ==18784==    by 0x600F61E: clone (in /lib64/libc-2.26.so)

However, clearly my semaphore_wait function is locking the mutex:

 111:        pthread_mutex_lock( &sem->mx );
 112:        if( !sem->data )
 113:            pthread_cond_wait( &sem->cd, &sem->mx );

Note, I've verified pthread_mutex_lock is returning success (which was the
first thought I had).

The second thing I noticed is that this is a warning about
pthread_cond_*SIGNAL* - which is the opposite side of the condition - I'm doing
a wait here.

It therefore looks like glibc is internally calling signal from wait, and
valgrind is reporting this as an error.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to