pthread rwlock deadlock detection

  • Thread starter Jaydeep Chovatia
  • Start date
J

Jaydeep Chovatia

Hi,

I have multi-threaded program (C++, Linux) in which I am using
pthread_rwlock_t to read/write lock the critical section. Under load
my program hangs in acquiring read lock. It seems like some writer has
not released the lock. I have doubled check my source code but no
success.
Is there any way to see thread ownership on mutex to get idea about
who is current owner? Is there any otherway to debug it?

Note: I am using PTHREAD_MUTEX_ERRORCHECK type of thread and checking
the return status while locking/unlocking. No error found during
locking/unlocking.

Thank you,
Jaydeep
 
G

gwowen

Is there any way to  see thread ownership on mutex to get idea about
who is current owner? Is there any otherway to debug it?

I've had some success with the valgrind --tool=helgrind, but its not a
panacea
 
I

Ian Collins

Hi,

I have multi-threaded program (C++, Linux) in which I am using
pthread_rwlock_t to read/write lock the critical section. Under load
my program hangs in acquiring read lock. It seems like some writer has
not released the lock. I have doubled check my source code but no
success.
Is there any way to see thread ownership on mutex to get idea about
who is current owner? Is there any otherway to debug it?

The easiest way is to wrap the mutex and instrument it (keep the owner
tid in the wrapper object) for debugging.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top