Signal handling thread not working.

Logan Gabriel gersh at tabby.sonn.com
Tue Jul 6 10:20:06 PDT 2004


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 at 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 at 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?


More information about the freebsd-threads mailing list