New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix process termination when /bin/sh is BusyBox #41
Conversation
It seems like bash is using `exec` by default for single commands provided via `-c`. BusyBox however is not. If `/bin/sh` is BusyBox (e.g. on Docker images based on Alpine) then the specified command becomes a subprocess of `/bin/sh`. This messes up signal handling and goreman fails to terminate the subprocesses when receiving a SIGTERM. Adding an explicit `exec` should fix this without modifying any command parsing.
This may address the same as #30. |
Right. LGTM |
Thanks for the quick merge! |
FYI previously goreman worked if your command started with environment specifiers, or if you used more complicated shell. eg: both these used to work
goreman now fails on both of those. The first failure is somewhat obvious since goreman will complain that it can't find the command some documentation or shell parsing would be useful in this case. I just updated my goreman, hence me only noticing this now. |
Hmm, sorry I didnot consider it. |
@neelance do you know the way to pass command-line into the busybox shell? and way to send signal to the process group? |
Is there some standard on how foreman tools are supposed to behave, e.g. which shell features are supposed to be supported? The first case that @keegancsmith mentioned could be solved by prepending I'm not sure what the best thing to do here is. But I think it would be better to avoid behavior that is different depending on which |
There doesn't really seem to be a standard. One could check the most popular Procfile runner and see how it behaves. Fixing signal behaviour is the correct thing to do, and prefixing exec seems like a good solution. From reading the POSIX standard I don't see anything preventing or condoning the automatic exec bash does. The only real way around this is to write a little wrapper script that traps the signal and manually sends it, which doesn't seem like a great thing. I think the best thing would be to somehow detect when there is a compound command, and Goreman warns/exits with a good error message to the user. |
How about to support both with new flag or environment variable? |
I'll revert this change. |
It seems like bash is using
exec
by default for single commands provided via-c
. BusyBox however is not. If/bin/sh
is BusyBox (e.g. on Docker images based on Alpine) then the specified command becomes a subprocess of/bin/sh
. This messes up signal handling and goreman fails to terminate the subprocesses when receiving a SIGTERM. Adding an explicitexec
should fix this without modifying any command parsing.