pthread rwlock deadlock detection

Discussion in 'C++' started by Jaydeep Chovatia, Oct 5, 2011.

  1. 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
    Jaydeep Chovatia, Oct 5, 2011
    #1
    1. Advertising

  2. Jaydeep Chovatia

    gwowen Guest

    On Oct 5, 10:09 pm, Jaydeep Chovatia <>
    wrote:

    > 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
    gwowen, Oct 6, 2011
    #2
    1. Advertising

  3. Jaydeep Chovatia

    Ian Collins Guest

    On 10/ 6/11 10:09 AM, Jaydeep Chovatia wrote:
    > 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.

    --
    Ian Collins
    Ian Collins, Oct 6, 2011
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. R Mar
    Replies:
    0
    Views:
    392
    R Mar
    Jan 3, 2004
  2. Avin
    Replies:
    2
    Views:
    15,569
    Jerald Fijerald
    May 8, 2004
  3. lokb
    Replies:
    7
    Views:
    8,742
    red floyd
    Jul 14, 2004
  4. Duncan Grisby

    Deadlock detection

    Duncan Grisby, Dec 6, 2004, in forum: Python
    Replies:
    7
    Views:
    570
    Mike Meyer
    Dec 11, 2004
  5. Jürgen Devlieghere

    read / write locks and deadlock detection

    Jürgen Devlieghere, Nov 29, 2005, in forum: C++
    Replies:
    2
    Views:
    444
    peter koch
    Nov 29, 2005
Loading...

Share This Page