Fix case where child process hangs after parent has been killed
Fix case where child process hangs after parent has been killed

A simple delete $self->{_child_read} is not enough to prevent the child
process from keeping the parent end of the pipe open.

Because the pipe is not closed, if the parent process dies, the children
continue until the pipe buffer fills. Then they hang trying to write
to it. But the parent process cannot be restarted as the children
have the listen socket open.

Deleting the _child_select, which also has a reference to _child_read
and explicitly closing _child_read causes a child to get a SIGPIPE
when it attempts to write to the parent after it has died. This causes
the child to also exit.

Also add or die to the write to the parent process, just in case the
application has ignored SIGPIPE.

This will ensure that if the parent unexpectedly dies without a chance
to signal the children, then the children will die off and the parent
can be restarted.

vlet/mojo,melezhik/mojo,melezhik/mojo,jenalgit/mojo,kraih/mojo,areggiori/mojo,lindleyw/mojo,andrewsolomon/mojo,Grinnz/mojo,zoffixznet/mojo,vlet/mojo,kiwiroy/mojo,kberov/mojo,jenalgit/mojo,polettix/mojo,kak-tus/mojo,augensalat/mojo,chenri/mojo,andrewsolomon/mojo,dolmen/p5-Mojolicious,scottw/mojo,CandyAngel/mojo,zoffixznet/mojo,s1037989/mojo,s1037989/mojo,dotandimet/mojo,marcusramberg/mojo,jamadam/mojo