Skip to content

Fixed graceful shutdown #414

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

taco-paco
Copy link
Contributor

@taco-paco taco-paco commented Jun 25, 2025

Right now our validator doesn't handle SIGTERM, only SIGINT.
This pr adds handling of SIGTERM signal

Greptile Summary

Enhanced validator shutdown handling by adding SIGTERM support alongside SIGINT, implementing a dedicated shutdown module for more robust signal management and cleanup.

  • Added new test-bins/src/shutdown.rs implementing platform-aware signal handling for both SIGTERM and SIGINT
  • Modified test-bins/src/rpc.rs to use the new Shutdown type for improved termination management
  • Implemented proper error handling for shutdown failures
  • Added platform-specific handling using cfg attributes to support both Unix and non-Unix systems

@taco-paco taco-paco marked this pull request as ready for review June 25, 2025 09:01
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 files reviewed, 1 comment
Edit PR Review Bot Settings | Greptile

Copy link
Collaborator

@thlorenz thlorenz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM


pub struct Shutdown;
impl Shutdown {
pub async fn wait() -> Result<(), io::Error> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: can't we just have a single function, without extra calls? Just having two wait methods with different cfgs?

Copy link
Contributor

@GabrielePicco GabrielePicco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

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.

4 participants