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

Implement graceful shutdown #2417

Open
kkovaacs opened this issue Nov 28, 2024 · 0 comments · May be fixed by #2456
Open

Implement graceful shutdown #2417

kkovaacs opened this issue Nov 28, 2024 · 0 comments · May be fixed by #2456
Assignees

Comments

@kkovaacs
Copy link
Contributor

Right now Pathfinder does not implement proper graceful shutdown. We do have some code in our main loop to stop on TERM and INT signals -- but we don't actually gracefully stop all tasks. This leads to some nasty side-effects, like the SQLite DB file being left "open" with the SHM / WAL file still present. (And possible more in the future: Cairo Native for example relies on temporary files which are not properly cleaned up unless we explicitly make sure that our global class cache is properly destroyed.)

The tokio documentation has a page on implementing graceful shutdown. We should look into how we could use CancellationToken and TaskTracker to make sure that we gracefully exit on receiving a TERM or INT signal. This involves making sure that all our "main" tasks (sync, RPC and P2P) exit gracefully including all their sub-tasks being cleaned up as well.

We should probably also add a grace period on shutdown: we should still exit after ~10s (should be configurable) even if not all tasks were properly stopped.

@CHr15F0x CHr15F0x self-assigned this Dec 3, 2024
@CHr15F0x CHr15F0x linked a pull request Dec 23, 2024 that will close this issue
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 a pull request may close this issue.

2 participants