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] New: pthread_exit from main thread: poor semantics, potential tty session lockup.
Date: Sat, 31 Jan 2009 03:18:00 -0000	[thread overview]
Message-ID: <20090131031846.9804.kkylheku@gmail.com> (raw)

(I'm using glibc 2.9; the Version field only goes up to 2.8. The following 
behavior occurs as far back as 2.5).

The kernel is 2.6.26. I'm running i686 and mips; it doesn't matter. I have not 
tried a newer kernel than this.

The issue is that if the main thread of a process terminates with 
pthread_exit, while other threads are still running, the kernel task 
associated with the main thread becomes defunct in some kind of sleep that 
cannot be interrupted by an ordinary signal. As such, the kernel will not 
allow job control to be performed on that process. The process cannot be 
suspended with Ctrl-Z from the shell, nor can it be killed with Ctrl-C.

Moreover, attempts to manipulate it in these ways can cause it to permanently 
hang in that sleep, and no longer terminate even when the other threads do. In 
that situation, the user cannot regain control over the tty session, except by 
logging in via another terminal and killing the defunct process with the 
SIGKILL signal.

The expected behavior is that the process should continue to exist as a normal 
process as long as at least one thread remains running. Normal POSIX job 
control should be possible over that process: switching its process group from 
the foreground to the background, killing it with Ctrl-C.

This may require either a kernel patch, or a change in glibc so that 
pthread_exit from the main thread does not in fact perform a task exit at the 
OS level, but merely a user-space synchronization on the other threads.

(I will explore this from a kernel angle and add any findings or patches here, 
using glibc 2.9 on 2.6.26 as my reference base).

-- 
           Summary: pthread_exit from main thread: poor semantics, potential
                    tty session lockup.
           Product: glibc
           Version: 2.8
            Status: NEW
          Severity: normal
          Priority: P2
         Component: nptl
        AssignedTo: drepper at redhat dot com
        ReportedBy: kkylheku at gmail dot com
                CC: glibc-bugs at sources dot redhat dot com


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.


             reply	other threads:[~2009-01-31  3:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-31  3:18 kkylheku at gmail dot com [this message]
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
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

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=20090131031846.9804.kkylheku@gmail.com \
    --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).