[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[rhelv6-list] pthread_rwlock_rdlock call hangs indefinitely


In my multi-threaded program I am using "pthread_rwlock_rdlock" to lock read/write mutex which is initialized with "PTHREAD_MUTEX_ERRORCHECK
Under load, call to "pthread_rwlock_rdlock" hangs indefinitely even though there are no writers holding the lock. Even after i stop load on my program, call is still hung. I tried to take the mutex condition when it was locked, please find here:

(gdb) p m_lock
$2 = {__data = {__lock = 0, __nr_readers = 1, __readers_wakeup = 60, __writer_wakeup = 1230, __nr_readers_queued = 2, __nr_writers_queued = 48,
    __writer = 0, __pad1 = 0, __pad2 = 0, __pad3 = 0, __flags = 0},
  __size = "\000\000\000\000\001\000\000\000<\000\000\000\316\004\000\000\002\000\000\000\060", '\000' <repeats 34 times>, __align = 4294967296}

After that I changed my lock from "pthread_rwlock_rdlock" to "pthread_rwlock_tryrdlock" and under load this new lock used to return EAGAIN sometimes. 

My question is why "pthread_rwlock_rdlock" hangs indefinitely. If there are more readers then it should return EAGAIN.

Any help on this would be appreciated.

OS Details: Red Hat Enterprise Linux Server release 6.0 (Santiago)
Linux rwcdtgxb0406 2.6.32-71.el6.x86_64 #1 SMP Wed Sep 1 01:33:01 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux

Thank you,

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]