Bug 169838 - pthread_kill(pthread_self) returns ESRCH
pthread_kill(pthread_self) returns ESRCH
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: glibc (Show other bugs)
4
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Brian Brock
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2005-10-04 07:02 EDT by Alexandra Kossovsky
Modified: 2007-11-30 17:11 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-10-04 07:17:30 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
test case mentioned in the bug description (889 bytes, text/plain)
2005-10-04 07:04 EDT, Alexandra Kossovsky
no flags Details

  None (edit)
Description Alexandra Kossovsky 2005-10-04 07:02:53 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.6) Gecko/20050405 Firefox/1.0 (Ubuntu package 1.0.2)

Description of problem:
in NPTL, pthread_self may be incorrect after two forks

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

How reproducible:
Always

Steps to Reproduce:
1. get a C file which I'll attach
2. compile it and run
3. find that pthread_kill(pthread_self(), SIGPIPE) returns ESRCH
  

Actual Results:  I see following output of the program:
1st thread b7e8ebb0, second b7e8ebb0
kill returned 3
pthread_join returned 0
(Note that kill returned 3!)

Expected Results:  I expect the same output as it is with only one fork():
1st thread b7e8ebb0, second b7e8ebb0
kill returned 0
pthread_join returned 0


Additional info:
Comment 1 Alexandra Kossovsky 2005-10-04 07:04:21 EDT
Created attachment 119583 [details]
test case mentioned in the bug description
Comment 2 Jakub Jelinek 2005-10-04 07:17:30 EDT
This testcase is invalid.
http://www.opengroup.org/onlinepubs/009695399/functions/fork.html
"If a multi-threaded process calls fork()," ...
"the child process may only execute async-signal-safe operations
 until such time as one of the exec functions is called."
http://www.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_04.html#tag_02_04_03
None of pthread_create, pthread_self, printf, pthread_join or exit (implicit
after return 0 from main) are async-signal-safe.

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