Skip to content

Kill with grace#367

Merged
gaborcsardi merged 23 commits into
mainfrom
kill-grace
Apr 23, 2026
Merged

Kill with grace#367
gaborcsardi merged 23 commits into
mainfrom
kill-grace

Conversation

@lionel-
Copy link
Copy Markdown
Member

@lionel- lionel- commented Apr 27, 2023

Branched from #366.

  • Revive the grace argument in the kill() method. We now first send a SIGTERM, wait for a grace period, and only then SIGKILL

  • To avoid a delay of grace seconds when the process terminates quickly, we poll for termination. This is supported by the same mechanism that is already implemented for wait(). The routine is split into an R-facing processx_wait() function and a C-facing c_processx_wait() variant which is called by the kill implementation.

  • The new() and run() methods of processes gain a cleanup_grace argument that is passed to kill() and kill_tree() on termination.

Comment thread src/test/sigtermignore.c Outdated
Comment thread src/unix/processx.c
Comment thread src/unix/processx.c
@gaborcsardi gaborcsardi changed the base branch from safe-cleanup to main April 23, 2026 09:25
Use px for a process w/ SIGTERM handler, instead of
the extra shared library.
@gaborcsardi gaborcsardi merged commit 610a26c into main Apr 23, 2026
31 of 32 checks passed
@gaborcsardi gaborcsardi deleted the kill-grace branch April 23, 2026 13:07
@gaborcsardi
Copy link
Copy Markdown
Member

Thank you, and sorry for the very long wait!

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.

2 participants