Skip to content
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

Replace bash image with java’s in akka-bash-template #446

Merged
merged 1 commit into from
Dec 28, 2014

Conversation

michalrus
Copy link
Contributor

There’s no need to keep the bash process running. Also, bash does not forward SIGTERM etc. to its child processes, so killing bash did not kill the java process.

There’s no need to keep the bash process running. Also,
bash does not forward SIGTERM etc. to its child processes,
so killing bash did not kill the java process.
@muuki88 muuki88 added feature request universal Zip, tar.gz, tgz and bash issues labels Dec 27, 2014
@muuki88
Copy link
Contributor

muuki88 commented Dec 27, 2014

thanks @michalrus for your pull request. This topic has been discussed/tested a lot.
You only removed the exec for this akka microkernel? Is it working for the regular
bash script?

See #168 (!!), #206 , #99, #149

@michalrus
Copy link
Contributor Author

@muuki88, I’ve only added exec to akka-microkernel script, because that is the only script I’m using. Sorry for not looking through the existing & closed issues, I treated this as a really quick fix. 😺

The issue is quite straightforward to me. I don’t want to have this in my process tree:

init(0)
  → bash              // known PID, *the* script I edited
    → java            // unknown PID :-(

Because:

  1. Killing bash (via SIGTERM) will not kill java.
  2. It's not easy to get java’s PID (e.g. to write to a PID file).
  3. When stopping the app, I've got to kill both java and bash.

However, with this tree:

init(0)
  → java              // known PID, because the bash used `exec java …`

… after starting the script, I can use $! to get java’s PID.

$ nohup bin/some-app >some-app.log &
$ echo $! >some-app.pid
$ cat some-app.pid
44877

SIGTERM-ing the PID will signal Akka to shutdown.

Another pro might be bash using 1–2M RAM on amd64, but I doubt anybody cares about that. 😸

Right now I’m using sed to add the exec before deploying, so… The decision is all yours. 😸 I'm fine with current situation.

@muuki88
Copy link
Contributor

muuki88 commented Dec 28, 2014

Oh no! Sorry... I.... well I missread the one line code -.-
Thanks for adding this missing piece :) :) Happy new year

muuki88 added a commit that referenced this pull request Dec 28, 2014
Replace bash image with java’s in akka-bash-template
@muuki88 muuki88 merged commit 34802cf into sbt:master Dec 28, 2014
@michalrus
Copy link
Contributor Author

Thank you and have a happy new year, too. =)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request universal Zip, tar.gz, tgz and bash issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants