This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: Need help to interpret pthread_mutex_t structure as printed by gdb
- From: Adhemerval Zanella <adhemerval dot zanella at linaro dot org>
- To: libc-help at sourceware dot org
- Date: Fri, 5 Aug 2016 11:44:13 -0300
- Subject: Re: Need help to interpret pthread_mutex_t structure as printed by gdb
- Authentication-results: sourceware.org; auth=none
- References: <CAF5YupLKz-CWdAp-X3Gdg+d_B9ijsjdOR0sFtoUhB4j6AOJZEw@mail.gmail.com>
On 04/08/2016 07:42, Olle Blomgren wrote:
> I have two processes that share mutexes laid out in a shared memory
> segment. After some execution where both processes intensively acquire
> and release mutexes in this shared memory segment, one thread in one
> of the processes blocks on a mutex and never continues. My initial
> debugging tells me that the mutex in question should have been woken
> up by the release of the lock by another thread, but it doesn't. To
> come further I need help with interpreting the mutex printout I get
> from the core file which I manually create from the frozen process.
>
> The GDB-printout:
>
> $1 = {__data = {__lock = 0, __nr_readers = 0, __readers_wakeup = 1941,
> __writer_wakeup = 425, :q' = 0, : = 1,
> __writer = 0, __shared = 0, __pad1 = 0, __pad2 = 0, __flags = 0}, __size =
> "\000\000\000\000\000\000\000\000\225\a\000\000\251\001\000\000\000\000\000
> \000\001", '\000' <repeats 34 times>, __align = 0}
>
> The mutex is an RW-lock and the attribute is: PTHREAD_PROCESS_SHARED
>
> The frozen thread holds a write-lock.
>
> Can anyone see what I'm missing by reading the mutex that blocks my
> thread, that should be running? Can anyone spot a memory overwrite
> that confuses the mutex?
I can't make any assumptions only this information provided. The
__nr_writers_queued being but without the lock seems to mean a thread
is blocked in nptl/pthread_rwlock_wrlock.c:67. However __nr_readers_queued
being 0 means the futex syscall should be issue to wake the write lock.
Could you provide the glibc version, a complete backtrace of both processes
and if possible a testcase?
>
> Thanks in advance
>