This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug nptl/9804] New: pthread_exit from main thread: poor semantics, potential tty session lockup.
- From: "kkylheku at gmail dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: 31 Jan 2009 03:18:47 -0000
- Subject: [Bug nptl/9804] New: pthread_exit from main thread: poor semantics, potential tty session lockup.
- Reply-to: sourceware-bugzilla at sourceware dot org
(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.