Subject: Re: [PATCH] Portability: returning void

From: Jonathan Nieder <[email-masked]>
Date: Tue, 29 Mar 2011 19:42:36 -0500

Jeff King wrote:

> No, you misunderstand. It is prove itself that ignores the SIGCHLD. It
> is stuck in the loop in TAP::Parser::Iterator::Process::_next. It has
> gotten SIGCHLD, but it keeps blocking waiting to get EOF on the child's
> stdout.

Thanks for clarifying.

> Doesn't that point to an unreaped process? After 100 seconds the sleep
> process closes, prove gets EOF, and it completes. Lowering the "100" to
> "1" caused a 1-second hang for me.

I guess it's just a matter of terminology.  To me, it points to an
undelivered signal, since the problem is not a zombie waiting to be
wait-ed on but a process still alive and sleeping.

> But instead of realizing its child has died, it
> insists on waiting until the pipe is closed. Nothing has to be adopted
> by init. There are simply still processes with the pipe open.

I meant that the sleep process is not a descendant of prove any
more.

| $ ps ax | egrep 'sleep|prove'
| 20203 pts/3    T      0:00 vim utils/prove
| 22654 pts/1    S+     0:00 /usr/bin/perl /usr/bin/prove --exec=bash
| t0081-line-buffer.sh
| 22688 pts/1    S+     0:00 sleep 100
| 22694 pts/1    S+     0:00 sleep 100
| 22727 pts/3    S+     0:00 egrep sleep|prove
| $ pstree -p 22654
| prove(22654)───bash(22655)

> Did you try my 5>/dev/null patch? With it, I get no hang at all.

Now I've tested it and it indeed works as advertised.

Sorry for the lack of clarity.