feat(node): add OS signal handling for graceful shutdown#3146
feat(node): add OS signal handling for graceful shutdown#3146theochap merged 4 commits intoop-rs:mainfrom
Conversation
Implements graceful shutdown for kona node by adding OS signal handlers (SIGTERM, SIGINT) that trigger the existing CancellationToken. All actors already receive CancellationToken for graceful shutdown, this change adds the missing OS signal handling to trigger it. Fixes op-rs#3091
3021e05 to
0b2dde2
Compare
Codecov Report❌ Patch coverage is
☔ View full report in Codecov by Sentry. |
theochap
left a comment
There was a problem hiding this comment.
Looks good, instead of using a separate thread, let's move the handler to the place where we instantiate the actors (in the macro's select statement).
I would like to see some additional simplifications to the cancellation logic before we close the linked issue. In particular, we should handle actor cancellation at the rollup_node::start level
- Move shutdown_signal() from node.rs to util.rs - Integrate signal handling directly into spawn_and_wait! macro's select loop - Remove separate tokio::spawn task for signal handling - Signal handling now occurs at the same level as actor lifecycle management This addresses the review feedback to handle signals in the macro's select statement rather than using a separate thread.
Done! Moved the signal handling into the macro's select loop as you suggested. |
|
This pull request has been automatically marked as stale because it has been inactive for 3 weeks. |
…3146) ## Summary - Added `shutdown_signal()` function to listen for SIGTERM and SIGINT - Spawned a task in `RollupNode::start()` that triggers the existing `CancellationToken` when OS signals are received - All actors already support graceful shutdown via CancellationToken, this just adds the missing OS signal handling ## Changes - Modified `crates/node/service/src/service/node.rs` - Cross-platform support: SIGTERM on Unix, Ctrl+C (SIGINT) on all platforms Closes #3091
Summary
shutdown_signal()function to listen for SIGTERM and SIGINTRollupNode::start()that triggers the existingCancellationTokenwhen OS signals are receivedChanges
crates/node/service/src/service/node.rsCloses #3091