From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2553 invoked by alias); 31 Jan 2009 07:02:01 -0000 Received: (qmail 30127 invoked by uid 48); 31 Jan 2009 07:01:44 -0000 Date: Sat, 31 Jan 2009 07:02:00 -0000 Message-ID: <20090131070144.30125.qmail@sourceware.org> From: "kkylheku at gmail dot com" To: glibc-bugs@sources.redhat.com In-Reply-To: <20090131031846.9804.kkylheku@gmail.com> References: <20090131031846.9804.kkylheku@gmail.com> Reply-To: sourceware-bugzilla@sourceware.org Subject: [Bug nptl/9804] pthread_exit from main thread: poor semantics, potential tty session lockup. X-Bugzilla-Reason: CC Mailing-List: contact glibc-bugs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: glibc-bugs-owner@sourceware.org X-SW-Source: 2009-01/txt/msg00150.txt.bz2 ------- Additional Comments From kkylheku at gmail dot com 2009-01-31 07:01 ------- (In reply to comment #1) > The tasks of the other threads terminate in ten seconds, but > the main one must be killed by SIGKILL, and control of the tty > cannot be wrestled away from it. This statement is wrong. In fact, the threads other than main do not terminate. They also stick around. Somehow, the Ctrl-Z signal prevents their termination. The main thread runs all the way through the do_exit routine in the kernel, and makes the final schedule call, turning into a defunct process. (I added traces to do_exit). The Ctrl-Z hang seems to be causing the othread threads to be stuck in the kernel function do_signal_stop, according to what is reported in /proc//wchan. The repro program is this: #include #include #include #include #define NUM_THREADS 5 void *task(void *a) { sleep(10); pthread_exit(NULL); } int main(int argc, char *argv[]) { pthread_t thr[NUM_THREADS]; int i; for (i = 0; i < NUM_THREADS; i++) { if (pthread_create(&thr[i], NULL, task, 0) != 0) { fprintf(stderr, "pthread_create failed\n"); return EXIT_FAILURE; } } pthread_exit(NULL); } -- 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.