-
Notifications
You must be signed in to change notification settings - Fork 271
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
Relay SIGTERM from docker stop to the child processes of /start #102
Conversation
This is a good idea but we might have to work on the implementation. Let's revisit after we get #109 in |
Is this issue still open after merging #109 in? Either way, if we want to pull this in, it'll have to rebase. |
This is most likely still an issue It would seem this is an unsolveable problem due to #114, which is inherently diametrically opposed to this (as noted in #114 (comment)). |
Okay, so I just looked at the way forego does it (traceback below), and what they do is basically construct a Bash script (passed to Bash with either
That said, having all Procfile entries implicitly be shell commands seems a bit wrong, since you should be able to have a 1:1 process correspondence, to be run with a hypervisor like, y'know, Docker. If Heroku's using shell scripts like this, then how are they stopping apps? Are they just sending them SIGKILL instead of stopping them (since it's basically impossible to forward a signal to a shell command)? |
One possibility occurs to me: do other shells forward signals to their subprocesses (is dropping signals on the floor while waiting a Bashism quirk)? If so, you can just |
Also, Bash appears to have different signal handling when |
Maybe |
The inescapable conclusion, for me, is that any Procfile command that uses shell features needs to be rewritten to be wrapped in In other words, any Procfile entry should be usable as a list of arguments to Yes, this may break some apps, or even some buildpacks, but re-introducing a shell wrapper is easy, and it lets the user insert an |
Well, on the subject of Procfile jobs supporting Bash scripts, on the, uh... hand that isn't the hand that supports that, https://github.com/heroku/hsup uses proc descriptions that are explicitly a binary and a list of arguments, which would imply that Procfiles are not meant to hold Bash scripts. (The way hsup converts the "commands" given by the API to this array appears to be by coercing the "commands" string returned by the API to an array, which I presume splits by fields: https://github.com/heroku/hsup/blob/master/api_poller.go#L20) |
Wait a second, that's an ordinary array constructor, taking a string... it just drops the command directly into an array of one item? WTF? |
And apparently it used to do this by converting the command to a Bash command as well, and this is a change that was made a couple months ago- and now |
Actually, the commit message to heroku/hsup@edbe4a1 has reminded me: ... Hey, wait a minute, I'm doing that already! What gives? |
Okay, final update: all my confusion around here was really just misdirected blame toward npm/npm#4603. Plushu (and probably whatever Dokku does now) is fine at relaying signals to child processes, because they exec through to that child process. The trouble comes when that child process doesn't exec through. |
I'm not sure if anyone else wants something like this, but I needed to make it to ensure that the child processes that were spawned by the start script were able to receive the SIGTERM that docker stop sends.
idea (and most of the code) from https://github.com/statianzo/dokku-shoreman/blob/master/post-release