fix: node graceful shutdown by handling SIGTERM - #2335
Conversation
WalkthroughThe update enhances the node's shutdown behavior by adding handling for the Changes
Sequence Diagram(s)sequenceDiagram
participant OS
participant NodeProcess
participant Logger
OS->>NodeProcess: Send SIGINT or SIGTERM
NodeProcess->>NodeProcess: Cancel context (initiate shutdown)
NodeProcess->>Logger: Log shutdown event
NodeProcess-->>OS: Graceful shutdown
Suggested labels
Suggested reviewers
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 golangci-lint (1.64.8)Error: you are using a configuration file for golangci-lint v2 with golangci-lint v1: please use golangci-lint v2 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
⏰ Context from checks skipped due to timeout of 90000ms (6)
🔇 Additional comments (2)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
Looks possibly related: celestiaorg/celestia-zkevm#50 |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2335 +/- ##
=======================================
Coverage 54.89% 54.89%
=======================================
Files 82 82
Lines 7503 7503
=======================================
Hits 4119 4119
Misses 2963 2963
Partials 421 421 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Fix graceful shutdown in Docker containers
Problem
When running the rollkit node in a Docker container and using
docker stop, the process doesn't shutdown gracefully and causes database corruption.Logs
Solution
SIGTERMsignal handling alongside existingSIGINThandlingsyscallimport to supportsyscall.SIGTERMChanges
StartNode()function incmd/run_node.goto listen for bothos.Interruptandsyscall.SIGTERMsyscallimportTesting
docker stopnow worksSummary by CodeRabbit