Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.
Bug 88219 - pthread_detach fails if thread has already exited
pthread_detach fails if thread has already exited
Product: Red Hat Linux
Classification: Retired
Component: glibc (Show other bugs)
i386 Linux
medium Severity high
: ---
: ---
Assigned To: Jakub Jelinek
Brian Brock
Depends On:
  Show dependency treegraph
Reported: 2003-04-07 15:46 EDT by Benjamin S. Scarlet
Modified: 2016-11-24 09:53 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2003-04-09 15:21:40 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2003:136 high SHIPPED_LIVE glibc bugfix errata 2003-04-09 00:00:00 EDT

  None (edit)
Description Benjamin S. Scarlet 2003-04-07 15:46:18 EDT
Description of problem:
The behaviour of pthread_detach has changed from previous versions, and seems
wrong. (Without the posix standard, which I don't have, I can't say for
certain). If the thread being detached has already exited, then pthread_detach
fails with ESRCH, where it used to succeed (and succeeds on Solaris). 

Version-Release number of selected component (if applicable):

How reproducible:
Every time.

Steps to Reproduce:
uudecode, gunzip, compile, and run the following code

begin 644 threadtest.c.gz

Actual results:
$ cc     threadtest.c  -lpthread -o threadtest
$ ./threadtest
foo start
foo done
failure:pthread_detach:3:No such process

Expected results:
$ cc     threadtest.c  -lpthread -o threadtest
$ ./threadtest
foo start
foo done

Additional info:
A cursory look at the code from the nptl in the glibc source RPM suggests that
the tid field in the pthread structure is set to zero when the thread
exits, and pthread_detach doesn't handle that situation. (Joining the thread
after it exits works fine, and pthread_join uses a different test which differs
only by the tid==0 case).
Comment 1 Jakub Jelinek 2003-04-09 15:21:40 EDT
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.


Note You need to log in before you can comment on or make changes to this bug.