tcsh-6.15 and gdb on FreeBSD is hanging

Alan Ferrency alan at pair.com
Mon May 14 17:11:58 EEST 2007


Hello,

I'm not familiar with the signal handling changes in tcsh in 6.15, but I
am familiar with signal handling changes in the FreeBSD-5 and -6
branches, compared to FreeBSD-4.

As a test, try tcsh 6.15 on FreeBSD 4, and see if it hangs similarly. If
not, then it is likely related to this.

The summary is: if you set the SIGCHLD signal handler to "ignore" (or,
if you use SA_NOCLDWAIT), then your parent process will never receive
notification when a child process exits. This means that it is almost
always wrong to call wait() when you have SIGCHLD set to ignore. Even if
you specify a single PID to wait for, the parent process will wait for
all child processes to complete, and will then return an ECHILD because
there are no child processes left.

A better tactic to avoid zombies seems to be to add a SIGCHLD handler
which waits for the specific PID, instead of ignoring SIGCHLD.

This change, first seen in the FreeBSD 5 branch, was presented as a
feature. However I can't see how it wouldn't break a world of code. And
as I said, since I'm not familiar with the changes in tcsh, it may not
apply directly in this case.

Thanks,

Alan Ferrency
pair Networks, Inc.
alan at pair.com


On Sun, 13 May 2007, Mark Peek wrote:

> I'm trying to narrow down a bug reported by a FreeBSD user but I wanted to
> enlist the help of the list in parallel.
>
> With a .cshrc containing this (without it works fine):
>
> setenv MAIL /var/log/`whoami`
>
> gdb will hang debugging this program:
>
> current32# echo $version
> tcsh 6.15.00 (Astron) 2007-03-03 (i386-intel-FreeBSD) options
> wide,nls,dl,al,kan,rh,color,filec
> current32# cat hello.c
> #include <stdio.h>
>
> int main(void) {
>      printf("hello world\n");
>      return 0;
> }
> current32# cc -o z -g hello.c
> current32# which gdb
> /usr/bin/gdb
> current32# gdb z
> GNU gdb 6.1.1 [FreeBSD]
> Copyright 2004 Free Software Foundation, Inc.
> GDB is free software, covered by the GNU General Public License, and you are
> welcome to change it and/or distribute copies of it under certain conditions.
> Type "show copying" to see the conditions.
> There is absolutely no warranty for GDB.  Type "show warranty" for details.
> This GDB was configured as "i386-marcel-freebsd"...
> (gdb) run
> Starting program: /root/bug/z
> ... HUNG ..
>
> Looking at a ps in a different window shows this:
>
> current32# ps -w -O sigcatch,sigignore,sigmask,sig
>    PID   CAUGHT  IGNORED  BLOCKED  PENDING  TT  STAT      TIME COMMAND
> 20741  9882003 1072c004        0        0  p0  Ss     0:00.37 -csh (csh)
> 29921    40087 18488000        0        0  p0  R      0:03.20 gdb z
> 29922  1882003 1840c004        0    80000  p0  RX+    0:01.46 /bin/csh -c exec
> /root/bug/z
> 29924  1882001 18728000        0        0  p0  Z+     0:00.02 <defunct>
>
> Note: I suspect this is due to the signal handling changes in 6.15 since 6.14
> works fine on the same system.
>
> Mark
>
> _______________________________________________
> Tcsh-Bugs mailing list
> Tcsh-Bugs at mx.gw.com
> http://mx.gw.com/mailman/listinfo/tcsh-bugs
>



More information about the Tcsh-Bugs mailing list