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

Run processes in new process groups, kill process group instead of process #1

Merged
merged 1 commit into from Oct 28, 2022

Conversation

dentarg
Copy link
Member

@dentarg dentarg commented Oct 28, 2022

This is ddollar#780 but for this repo, original description below


This is ddollar#723 but rebased against master today. Credit to @davishmcclurg for suggesting those changes in the first place.

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.

I think this change also addresses ddollar#779. It makes Foreman match what Honcho does, and Honcho does not exhibit the problem shown in ddollar#779.

Close ddollar#779

(Some additional background: There was an earlier PR ddollar#528 that did half of what this PR does, ddollar#525 was closed after that was merged, but then the PR was reverted after a few days, could not find the reason for that).

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.
@dentarg dentarg merged commit 65af5e7 into master Oct 28, 2022
@dentarg dentarg deleted the pgroup branch October 28, 2022 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Foreman does not terminate child process
1 participant