public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "kkylheku at gmail dot com" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sources.redhat.com
Subject: [Bug nptl/9804] pthread_exit from main thread: poor semantics, potential tty session lockup.
Date: Sat, 31 Jan 2009 07:43:00 -0000	[thread overview]
Message-ID: <20090131074337.4407.qmail@sourceware.org> (raw)
In-Reply-To: <20090131031846.9804.kkylheku@gmail.com>


------- Additional Comments From kkylheku at gmail dot com  2009-01-31 07:43 -------
I have a better understanding what is going on in the kernel. The main thread 
has terminated.  The Ctrl-Z sends a SIGTSTP to the remaining threads in the 
normal way. The threads are suspended. Only, the defunct main thread is not 
available for handling the state transition properly. The expected behavior is 
that a status change occurs in the process that is detected by the shell which 
can then report that the job is in the background. This does not happen for 
the defunct process.

I don't think there is an easy way to fix this. The exit handling has to be 
changed in the kernel. If a thread which behaves like a main thread is 
terminating, it cannot simply run through do_exit and become a zombie. It 
should enter into some kind of wait function in the kernel to join the others. 
While in that function, it should be a regular sleep in which it can handle 
job-control-related signals.

A workaround could be hacked in glibc's __libc_start_main; a kind of 
synchronization on the termination of the other threads. The actual call to 
__exit_thread could be delayed until the other threads are known to have 
terminated (all the way to the kernel; I see there is a notification mechanism 
for a tid being cleared, and it acts as a futex too).







-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=9804

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


  parent reply	other threads:[~2009-01-31  7:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-31  3:18 [Bug nptl/9804] New: " kkylheku at gmail dot com
2009-01-31  3:29 ` [Bug nptl/9804] " kkylheku at gmail dot com
2009-01-31  7:02 ` kkylheku at gmail dot com
2009-01-31  7:43 ` kkylheku at gmail dot com [this message]
2009-02-01 21:14 ` kkylheku at gmail dot com
2009-02-01 22:10 ` kkylheku at gmail dot com
2009-02-03  2:30 ` kkylheku at gmail dot com
     [not found] <bug-9804-131@http.sourceware.org/bugzilla/>
2014-07-01 21:00 ` fweimer at redhat dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090131074337.4407.qmail@sourceware.org \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).