From owner-freebsd-threads@FreeBSD.ORG Tue Jul 6 17:20:06 2004 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 031B916A4CE for ; Tue, 6 Jul 2004 17:20:06 +0000 (GMT) Received: from tabby.sonn.com (tabby.sonn.com [193.72.216.18]) by mx1.FreeBSD.org (Postfix) with ESMTP id EBB1F43D58 for ; Tue, 6 Jul 2004 17:20:05 +0000 (GMT) (envelope-from gersh@tabby.sonn.com) Received: from tabby.sonn.com (gersh@localhost [127.0.0.1]) by tabby.sonn.com (8.12.9/8.12.3) with ESMTP id i66HOfDE063579 for ; Tue, 6 Jul 2004 10:24:41 -0700 (PDT) (envelope-from gersh@tabby.sonn.com) Received: from localhost (gersh@localhost) by tabby.sonn.com (8.12.9/8.12.3/Submit) with ESMTP id i66HOfUd008262 for ; Tue, 6 Jul 2004 10:24:41 -0700 (PDT) Date: Tue, 6 Jul 2004 10:24:41 -0700 (PDT) From: Logan Gabriel To: freebsd-threads@freebsd.org Message-ID: <20040706093353.K13095@tabby.sonn.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: Signal handling thread not working. X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2004 17:20:06 -0000 Hello, I am writing a multi threaded daemon for a number of unix platforms. In this daemon I create one thread to do signal handling with sigwait(). Signals in all other threads are blocked out. There is a problem with SIGCHLD in many FreeBSD thread libs, (It creates a zombie process). (Source code for example application: http://67.41.131.100/pthreadbug.c) The real application runs on 4.x and uses linuxthreads from ports so that is what I am most interested in having resolved, however I have noticed this code produces zombie processes with the normal user threads library (-pthread) on 4.x and with -lc_r in 5.x # # FreeBSD 4.9-STABLE #0: Wed Nov 12 23:16:46 GMT 2003 # [root@vmware] gcc -o pthreadbug pthreadbug.c -pthread ./pthreadbug ### Sigwait is now blocking. ### Child process 33108 exited. ### Child process 33109 exited. ^Z [1]+ Stopped ./pthreadbug [root@vmware] ps -axwwg | grep pthreadbug 33107 p1 T 0:00.01 ./pthreadbug 33108 p1 Z 0:00.00 (pthreadbug) 33109 p1 Z 0:00.00 (pthreadbug) Compilation with the linux threads library: gcc -I/usr/local/include/pthread/linuxthreads -o pthreadbug pthreadbug.c -L/usr/local/lib -llthread In a very recent version of -CURRENT (two weeks ago) -lpthread works as expected, however -lc_r does not. This exact same code produces the expected output (no zombie procs) in Linux (RedHat 9.1 / SuSE 9.1), and Solaris 8, so I am fairly confident this code "should" work as I am expecting. Any thoughts?