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

termio/exec: call waitpid in process exit callback #5353

Merged
merged 1 commit into from
Jan 24, 2025
Merged

Conversation

mitchellh
Copy link
Contributor

Fixes #4554

When a process exited on its own (we didn't kill it), we were not calling waitpid. This commit adds a waitpid call in the event loop process exit notification.

This happened because when an external exit happened we could call subprocess.externalExit which tells our subprocess manager to NOT kill the process (since its already dead). Unfortunately in this case it means we also didn't call waitpid.

Fixes #4554

xev.Process.wait is documented as being equivalent to calling `waitpid`,
i.e. including reaping the process. On Linux, it does this automatically
by using pidfd and the `waitid` syscall. On macOS, it wasn't doing this.

This commit updates libxev to include a fix that explicitly calls
`waitpid` for kqueue.
@mitchellh mitchellh enabled auto-merge January 24, 2025 20:07
@mitchellh mitchellh merged commit 75d6ee5 into main Jan 24, 2025
59 checks passed
@mitchellh mitchellh deleted the push-nzltwusqqkls branch January 24, 2025 20:19
@github-actions github-actions bot added this to the 1.1.0 milestone Jan 24, 2025
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.

Zombie process leaks
1 participant