linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Hang opening a pipe written to by a child, with SIGCHLD
@ 2012-04-02 14:46 Lluís Batlle i Rossell
  2012-04-02 14:49 ` Shea Levy
  0 siblings, 1 reply; 6+ messages in thread
From: Lluís Batlle i Rossell @ 2012-04-02 14:46 UTC (permalink / raw)
  To: linux-kernel

Hello,

I had troubles running a simple bash script where a child wrote to a named pipe
before dying, and the parent opened and read the pipe.

On a computer, my script hangs always. Also under 'strace'. Not under 'strace
-f'. Thinking of some race, I wrote a small script that hangs in the linuxes I
could try (3.2.11 now):

----------
#!/var/run/current-system/sw/bin/bash

PIPE=/tmp/pipe

rm -f $PIPE
mkfifo $PIPE

function spawn {
    echo DONE > $PIPE
}

spawn sleep 1 &

while true; do
    echo reading
    while read LINE < $PIPE; do
        echo $LINE
        spawn &
    done
done
-------------

bash uses SA_RESTART on SIGCHLD handler, and nevertheless the script halts at
printing some amount of 'DONE'. Strace shows it's inside the open() call, while the open
call has been interrupted by SIGCHLD. One of the computers I have hangs at the *first* DONE always, and that's why it's annoying to me.

Can anyone reproduce this?

Regards,
Lluís.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-04-10 23:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20120409120326.f0ce7a94.akpm@linux-foundation.org>
2012-04-10 22:55 ` Hang opening a pipe written to by a child, with SIGCHLD Oleg Nesterov
2012-04-10 23:12   ` Oleg Nesterov
2012-04-02 14:46 Lluís Batlle i Rossell
2012-04-02 14:49 ` Shea Levy
2012-04-02 18:50   ` Lluís Batlle i Rossell
2012-04-02 20:20     ` Lluís Batlle i Rossell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).