Bug 169838 - pthread_kill(pthread_self) returns ESRCH
Summary: pthread_kill(pthread_self) returns ESRCH
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: glibc
Version: 4
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Brian Brock
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2005-10-04 11:02 UTC by Alexandra Kossovsky
Modified: 2007-11-30 22:11 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2005-10-04 11:17:30 UTC
Type: ---
Embargoed:


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

Description Alexandra Kossovsky 2005-10-04 11:02:53 UTC
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 11:04:21 UTC
Created attachment 119583 [details]
test case mentioned in the bug description

Comment 2 Jakub Jelinek 2005-10-04 11:17:30 UTC
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.