Red Hat Bugzilla – Bug 112512
pthread_setcancelstate does not work
Last modified: 2007-11-30 17:10:34 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.1)
Description of problem:
In the soon-to-be-attached test program, I'm able to cancel a thread
despite it having disabled cancellation through pthread_setcancelstate.
This occurs with glibc-2.3.2-101.1 on Fedora Core 1 with both
kernel-2.4.22-1.2115.nptl and kernel-2.6.0-0.test11.1.13. I'm using an
AMD Athlon system.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Save the attached bad_cancellation.c to a file.
$ gcc -Wall bad_cancellation.c -o bad_cancellation -lpthread
Actual Results: It exits almost immediately with the message
"Canceled thread with cancellation disabled."
Expected Results: It loops forever.
Marking "high" severity as there's no way my code can use thread
cancellation safely with this bug.
Created attachment 96661 [details]
2003-12-19 Jakub Jelinek <firstname.lastname@example.org>
* libc-cancellation.c (__libc_enable_asynccancel): Don't cancel
if CANCELSTATE_BITMASK is set.
* sysdeps/pthread/librt-cancellation.c (__librt_enable_asynccancel):
* Makefile (tests): Add tst-cancel22 and tst-cancel23.
(tests-reverse): Add tst-cancel23.
* tst-cancel22.c: New test.
* tst-cancel23.c: New test.
It will take a few days till there will be FC1 testing updates for glibc
Excellent. Thank you.
glibc-2.3.3-3 indeed fixes this for me. Thanks again.
An errata has been issued which should help the problem described in this bug report.
This report is therefore being closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files, please follow the link below. You may reopen
this bug report if the solution does not work for you.