From owner-freebsd-bugs Fri Mar 29 17:20:15 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 1804237B41A for ; Fri, 29 Mar 2002 17:20:01 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g2U1K1t82985; Fri, 29 Mar 2002 17:20:01 -0800 (PST) (envelope-from gnats) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id F3B1437B41A for ; Fri, 29 Mar 2002 17:18:06 -0800 (PST) Received: (from nobody@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g2U1I6W82724; Fri, 29 Mar 2002 17:18:06 -0800 (PST) (envelope-from nobody) Message-Id: <200203300118.g2U1I6W82724@freefall.freebsd.org> Date: Fri, 29 Mar 2002 17:18:06 -0800 (PST) From: Gurusamy Sarathy To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-1.0 Subject: kern/36515: SA_NOCLDWAIT has no effect when linking with -pthread Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 36515 >Category: kern >Synopsis: SA_NOCLDWAIT has no effect when linking with -pthread >Confidential: no >Severity: critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Mar 29 17:20:00 PST 2002 >Closed-Date: >Last-Modified: >Originator: Gurusamy Sarathy >Release: 4.2-RELEASE >Organization: ActiveState Corp. >Environment: FreeBSD clamp 4.2-RELEASE FreeBSD 4.2-RELEASE #0: Mon Nov 20 13:02:55 GMT 2000 jkh@bento.FreeBSD.org:/usr/src/sys/compile/GENERIC i386 >Description: Merely linking a program with -pthread causes it to start producing zombies, even though the program has explicitly set the SIGCHLD disposition using SA_NOCLDWAIT. Problem does not appear when not linking with -pthread. The supplied test case should be self- explanatory. >How-To-Repeat: /* * Demonstrate that SA_NOCLDWAIT doesn't work when linking with -pthread * under FreeBSD 4.2-RELEASE. * * This program has different behavior when built with and without * -pthread. When built with -pthread, it will create zombies. * * The two variants can be built with: * * cc -o sig sig.c * cc -o sig sig.c -pthread */ #include #include #include int main(int ac, char **av) { struct sigaction sa; sa.sa_handler = SIG_IGN; sa.sa_flags = SA_NOCLDWAIT; sigemptyset(&sa.sa_mask); sigaction(SIGCHLD,&sa,NULL); while (1) { int c = fork(); if (c < 0) { fprintf(stderr, "fork() failed: %s\n", strerror(errno)); exit(1); } if (!c) { exit(0); } sleep(1); } } >Fix: Don't know of a fix, but the workaround is to install an explicit handler to reap the children. >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message