Repository navigation
feat(daemon): add SIGUSR1 graceful exit and SIGUSR2 progress dump signals - #2494
Merged
Merged
Conversation
…nals Register SIGUSR1 and SIGUSR2 handlers in the daemon signal framework using the existing signal-hook crate. SIGUSR1 sets a graceful_exit flag that stops accepting new connections and drains active workers before exit, mirroring upstream rsync's RERR_SIGNAL1 behavior. SIGUSR2 sets a progress_dump flag that logs active connections, total served, and uptime on the next loop iteration. Both flags are wired into the single-listener and multi-listener (dual-stack) accept loops. The graceful_exit flag is also shared with acceptor threads so they stop promptly. All signal handling is gated with #[cfg(unix)] as before.
oferchen
added a commit
that referenced
this pull request
May 1, 2026
…nals (#2494) Register SIGUSR1 and SIGUSR2 handlers in the daemon signal framework using the existing signal-hook crate. SIGUSR1 sets a graceful_exit flag that stops accepting new connections and drains active workers before exit, mirroring upstream rsync's RERR_SIGNAL1 behavior. SIGUSR2 sets a progress_dump flag that logs active connections, total served, and uptime on the next loop iteration. Both flags are wired into the single-listener and multi-listener (dual-stack) accept loops. The graceful_exit flag is also shared with acceptor threads so they stop promptly. All signal handling is gated with #[cfg(unix)] as before.
oferchen
added a commit
that referenced
this pull request
May 5, 2026
…nals (#2494) Register SIGUSR1 and SIGUSR2 handlers in the daemon signal framework using the existing signal-hook crate. SIGUSR1 sets a graceful_exit flag that stops accepting new connections and drains active workers before exit, mirroring upstream rsync's RERR_SIGNAL1 behavior. SIGUSR2 sets a progress_dump flag that logs active connections, total served, and uptime on the next loop iteration. Both flags are wired into the single-listener and multi-listener (dual-stack) accept loops. The graceful_exit flag is also shared with acceptor threads so they stop promptly. All signal handling is gated with #[cfg(unix)] as before.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
graceful_exitflag, causing the daemon to stop accepting new connections and drain active workers before exiting cleanly (mirrors upstream rsync's RERR_SIGNAL1 / exit code 19 behavior)progress_dumpflag, causing the daemon to log a summary of active connections, total connections served, and daemon uptime on the next loop iteration (mirrors upstream rsync's SIGUSR2 statistics dump)graceful_exitwith acceptor threads for prompt shutdown#[cfg(unix)]; non-Unix platforms get no-op defaultsTest plan
cargo fmt -p daemon -- --checkpassescargo clippy -p daemon --all-targets --all-features --no-deps -- -D warningspassescargo nextest run -p daemonpasses (843 tests)kill -USR1 <pid>and verify graceful drainkill -USR2 <pid>and verify progress log output