Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > pthread_rwlock_rdlock hangs

Reply
Thread Tools

pthread_rwlock_rdlock hangs

 
 
Jaydeep Chovatia
Guest
Posts: n/a
 
      10-06-2011
Hi,

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,
Jaydeep
 
Reply With Quote
 
 
 
 
Ian Collins
Guest
Posts: n/a
 
      10-06-2011
On 10/ 7/11 08:32 AM, Jaydeep Chovatia wrote:
>
> 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


This isn't a C++ issue, try a Linux group or comp.programming.threads.

--
Ian Collins
 
Reply With Quote
 
 
 
 
Adam Skutt
Guest
Posts: n/a
 
      10-06-2011
On Oct 6, 3:32*pm, Jaydeep Chovatia <(E-Mail Removed)>
wrote:
> Hi,
>
> 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:


I'm not quite confident about what's going on, since you seem to be
confusing two separate concurrency structures. But only recursive
mutexes can be locked more than once by the same thread, so I'm pretty
confident you're attempting to do something you should not. Error-
checking mutexes return an error when they are locked twice, you're
probably not checking for the error correctly.

A more detailed response is going to require actual code and should
probably be addressed to a different newsgroup.

Adam
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Gem hangs => TCPSocket.write hangs Tim Shadel Ruby 1 07-24-2005 06:11 AM
Firefox hangs using pull-down menus Jim Lahue Firefox 1 06-07-2005 03:47 PM
Firefox hangs/slow load - especially on web ads - help! iDAHOPRiME Firefox 2 01-06-2005 12:58 PM
Thunderbird hangs when I ask it to search for new extensions Marc Rios Firefox 1 08-26-2004 06:51 AM
Clear hangs up - & hangs up - & hangs up Sue Bilstein NZ Computing 26 03-07-2004 01:33 AM



Advertisments