On Sat, Jul 26, 2014 at 10:44:18AM +0200, c...@webprojekty.cz wrote: > Hello, I wrote a patch for how broken filedescriptors when creating child > are handled. Currently only the child dies, leaving non-working instance of > runsv in place. My patch makes it kill the parent so the runsv process can > be respawned properly when it gets to the state in which it can't produce > working children.
Thanks for the patch, but it works around the bug and doesn't fix its root cause. Laurent was correct when analysing this a few years ago, thanks for that http://permalink.gmane.org/gmane.comp.sysutils.supervision.general/2026 Here's how to reproduce: $ mkdir -p bug/log $ cat <<EOT >bug/run && chmod 755 bug/run #!/bin/sh exec sleep 14 EOT $ cat <<EOT >bug/log/run && chmod 755 bug/log/run #!/bin/sh exec sleep 47 EOT $ runsv ./bug & [1] 2016 $ sv x ./bug $ sv u ./bug runsv ./bug: fatal: unable to setup filedescriptor for ./run: file descriptor not open ... runsv was told to exit, but does not do so until service and log service have terminated. It sent TERM to the service, closed the pipe and so standard input of the log service, and expects it to terminate now. If the log service doesn't do so, and runsv is asked to startup the service again, that it was previously told to take down and then exit, the bug accurs as the pipe is no longer available. Regards, Gerrit.