Skip to content

Remove process group to avoid hanging daemons#6582

Merged
headius merged 1 commit intojruby:jruby-9.2from
headius:ungroup_popen
Feb 28, 2021
Merged

Remove process group to avoid hanging daemons#6582
headius merged 1 commit intojruby:jruby-9.2from
headius:ungroup_popen

Conversation

@headius
Copy link
Member

@headius headius commented Feb 26, 2021

In #5383 we added logic to create a new process group when doing
chdir in spawn, to avoid orphaning the eventual process spawned
by the intermediate sh. Unfortunately this has a side effect of
hanging on waitpid if the process spawns a long-running daemon.

This patch removes the process group and instead uses exec in the
generated sh script so that the sh process is replaced. The forked
daemon lives on, as it should, but only the main process is
waited on.

Fixes #6579

@headius headius added this to the JRuby 9.2.16.0 milestone Feb 26, 2021
@headius headius changed the base branch from master to jruby-9.2 February 26, 2021 17:30
In jruby#5383 we added logic to create a new process group when doing
chdir in spawn, to avoid orphaning the eventual process spawned
by the intermediate sh. Unfortunately this has a side effect of
hanging on waitpid if the process spawns a long-running daemon.

This patch removes the process group and instead uses exec in the
generated sh script so that the sh process is replaced. The forked
daemon lives on, as it should, but only the main process is
waited on.

Fixes jruby#6579
@headius
Copy link
Member Author

headius commented Feb 26, 2021

We have a winner!

@headius headius requested a review from enebo February 26, 2021 20:14
@headius
Copy link
Member Author

headius commented Feb 26, 2021

No idea how to test this one.

@headius headius merged commit 97d78e6 into jruby:jruby-9.2 Feb 28, 2021
@headius headius deleted the ungroup_popen branch February 28, 2021 19:21
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.

Upgrade to 9.2.15.0 causes Kernel#system to hang.

1 participant