This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug nptl/21291] New: pthread cancellation fails when contending lock
- From: "dimitri.staessens at ugent dot be" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Wed, 22 Mar 2017 21:12:59 +0000
- Subject: [Bug nptl/21291] New: pthread cancellation fails when contending lock
- Auto-submitted: auto-generated
https://sourceware.org/bugzilla/show_bug.cgi?id=21291
Bug ID: 21291
Summary: pthread cancellation fails when contending lock
Product: glibc
Version: 2.25
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: nptl
Assignee: unassigned at sourceware dot org
Reporter: dimitri.staessens at ugent dot be
CC: drepper.fsp at gmail dot com
Target Milestone: ---
Created attachment 9930
--> https://sourceware.org/bugzilla/attachment.cgi?id=9930&action=edit
code example that reproduces the problem
We found that with the 2.25 release of glibc, sometimes pthread_cancel fails to
cancel threads that are contending a robust mutex. At least, that's what we
think is happening. It's not that easy to explain, so find attached a code
example that reproduces the problem.
In the code it has a TIMEOUT defined, increasing the value will reduce the
chances of the cancel failing as the threads are more likely to be in the
timedwait. On glibc 2.24 it works even with a timeout set to 0 (it is set to 0
in the attached source file).
We run the following commands:
gcc robust_test.c -lpthread -lrt -o robust_test
./robust_test
expected output is:
Initializing...
Starting threads...
Sleeping for one second...
Thread started...
Thread started...
Cancelling threads...
Threads finished.
Bye.
Which works fine on glibc 2.24-2 (Arch Linux). However, on glibc 2.25-1, it
hangs at "Cancelling threads...":
Initializing...
Starting threads...
Sleeping for one second...
Thread started...
Thread started...
Cancelling threads...
I hope this report is useful to you.
Sincerely,
Dimitri Staessens.
--
You are receiving this mail because:
You are on the CC list for the bug.