-
Notifications
You must be signed in to change notification settings - Fork 631
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
Run processes in new pgroup #723
base: main
Are you sure you want to change the base?
Conversation
Some processes are getting orphaned when running Foreman with JRuby. Creating a new pgroup allows them all to be killed together. I believe the issue is related to how JRuby handles `Dir.chdir` by creating a shell process: `sh -c 'cd /chdir/target; ${command}'`. That causes a second process to be created that won't get cleaned up by killing the parent.
@@ -191,14 +191,14 @@ def kill_children(signal="SIGTERM") | |||
@running.each do |pid, (process, index)| | |||
system "sending #{signal} to #{name_for(pid)} at pid #{pid}" | |||
begin | |||
Process.kill(signal, pid) | |||
Process.kill("-#{signal}", pid) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sends the signal to all processes in the group. I still saw leftover processes when the signal was sent only to the parent
This PR is needed for |
I think there's a new version here: #780 |
@davishmcclurg Yes, that was actually the branch I tested with. |
I forked foreman and merged #780 (this PR but rebased) and released the fork as |
Some processes are getting orphaned when running Foreman with JRuby.
Creating a new pgroup allows them all to be killed together.
I believe the issue is related to how JRuby handles
Dir.chdir
bycreating a shell process:
sh -c 'cd /chdir/target; ${command}'
. Thatcauses a second process to be created that won't get cleaned up by
killing the parent.