ddollar / foreman

Manage Procfile-based applications
http://ddollar.github.com/foreman
MIT License
6.01k stars 630 forks source link

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

Closed dentarg closed 1 year ago

dentarg commented 1 year ago

This is https://github.com/ddollar/foreman/pull/780 but for this repo, original description below


This is https://github.com/ddollar/foreman/pull/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 #779. It makes Foreman match what Honcho does, and Honcho does not exhibit the problem shown in #779.

Close #779

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

dentarg commented 1 year ago

🤦

Wrong repo.