Skip to content
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

Global sidecar state for safe shutdown #673

Open
mempirate opened this issue Jan 13, 2025 · 1 comment
Open

Global sidecar state for safe shutdown #673

mempirate opened this issue Jan 13, 2025 · 1 comment
Assignees
Labels
C: bolt-sidecar Component: bolt-sidecar T: security Type: Security
Milestone

Comments

@mempirate
Copy link
Contributor

mempirate commented Jan 13, 2025

Context

Currently, there's no way to gracefully shut down the sidecar without risking a commitment fault. We should have a global, cloneable state watcher with the following states:

  • Available
  • PendingShutdown
  • Shutdown

Upon a first interrupt (CTRL+C), the state should be set to PendingShutdown (should be event based, like a watch channel). This event will be caught by all actor tasks, and will kick off a process that checks whether we have any upcoming proposer duties with commitments. If we do, this process will wait until that slot has passed, and only then fire a Shutdown event, which will result in the actual shutting down of all actors and finally the process itself.

The API should ALWAYS reflect the state in any API responses (503 Service Unavailable if PendingShutdown). This ensures we can actually shut down without adding in new commitments.

So we should have a bi-directional communication channel:

  • top level interrupt handler fires an event to all receivers
  • receivers start cleaning up, and send an ack back up the channel when done
  • only shut down when all acks are received

Note that this would be slightly less important with a persistent fallback block cache, but still important.

We should also have a way to force exit (i.e. press ctrl+c 3 times or something)

@mempirate mempirate added C: bolt-sidecar Component: bolt-sidecar T: security Type: Security labels Jan 13, 2025
@mempirate mempirate added this to the v0.4.1 milestone Jan 13, 2025
@thedevbirb
Copy link
Contributor

Slightly related: #552 (comment) (cancellation tokens)

@merklefruit merklefruit self-assigned this Jan 13, 2025
@mempirate mempirate changed the title Global sidecar state Global sidecar state for safe shutdown Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: bolt-sidecar Component: bolt-sidecar T: security Type: Security
Projects
None yet
Development

No branches or pull requests

3 participants