This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug nptl/23844] New: pthread_rwlock_trywrlock results in hang
- From: "mike at marxmeier dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Tue, 30 Oct 2018 08:10:29 +0000
- Subject: [Bug nptl/23844] New: pthread_rwlock_trywrlock results in hang
- Auto-submitted: auto-generated
https://sourceware.org/bugzilla/show_bug.cgi?id=23844
Bug ID: 23844
Summary: pthread_rwlock_trywrlock results in hang
Product: glibc
Version: unspecified
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: nptl
Assignee: unassigned at sourceware dot org
Reporter: mike at marxmeier dot com
CC: drepper.fsp at gmail dot com
Target Milestone: ---
Created attachment 11373
--> https://sourceware.org/bugzilla/attachment.cgi?id=11373&action=edit
Test case
After upgrading from glibc 2.23 to 2.26, we've been seeing what looks like
a hang inside pthread_rwlock calls in our application.
A pthread_rwlock_trywrlock as a "quick path" if a lock is available.
Otherwise a pthread_rwlock_wrlock is used along with additional
measurement information.
if((ecode = pthread_rwlock_trywrlock(&rw_lock[idx]))) {
if(ecode == EBUSY)
ecode = pthread_rwlock_wrlock(&rw_lock[idx]);
if(ecode) {
perror("pthread_rwlock_wrlock");
exit(1);
}
}
This should behave identically to pthread_rwlock_wrlock().
It does result in a hang with the lock not taken but all
threads blocked in pthread_rwlock calls.
The attached test case makes it easily reproducible.
The lock state looks like this:
{__data = {__lock = 10, __nr_readers = 0, __readers_wakeup = 2,
__writer_wakeup = 3, __nr_readers_queued = 0, __nr_writers_queued = 0,
__writer = 0, __shared = 0, __rwelision = 0 '\000',
__pad1 = "\000\000\000\000\000\000", __pad2 = 0, __flags = 0},
__size = "\n\000\000\000\000\000\000\000\002\000\000\000\003", '\000'
<repeats 42 times>, __align = 10}
Threads are suspended in pthread_rwlock_wrlock or pthread_rwlock_rdlock
2 Thread 0x7fb876c92700 (LWP 28072) "rwl_g" 0x00007fb87705e585 in
pthread_rwlock_wrlock () from /lib64/libpthread.so.0
3 Thread 0x7fb876491700 (LWP 28073) "rwl_g" 0x00007fb87705e12a in
pthread_rwlock_rdlock () from /lib64/libpthread.so.0
4 Thread 0x7fb875c90700 (LWP 28074) "rwl_g" 0x00007fb87705e585 in
pthread_rwlock_wrlock () from /lib64/libpthread.so.0
* 5 Thread 0x7fb87548f700 (LWP 28075) "rwl_g" 0x00007fb87705e63f in
pthread_rwlock_wrlock () from /lib64/libpthread.so.0
--
You are receiving this mail because:
You are on the CC list for the bug.