-
Notifications
You must be signed in to change notification settings - Fork 106
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
Interrupt handler does not work when a blocking task is running #1351
Comments
I've observed a complete hang on Ctrl-C (SIGINT) on Linux, when the sync service was waiting to restart the sync:
Backgrounding the task using Marking this usability issue as medium, because we've seen it in practice, but it seems to be rare. |
We've improved this a lot, and some of the blocking is meant to happen (like database cleanup or ephemeral database deletion). |
Scheduling
This usability issue is acceptable for the first stable release, but we should review for lightwalletd.
Version
main
Description
The interrupt handler does not work when the application is busy (i.e., when it is probably needed). This is because the interrupt handler shares priority with the main application future, and futures do cooperative multitasking:
zebra/zebrad/src/components/tokio.rs
Lines 49 to 52 in d4da960
Tasks
spawn
, andspawn
.We use
spawn
for the interrupt future so it can be scheduled on any thread. This ensures that the shutdown task will run, even if there are long-running or blocking tasks in other futures.Alternatives
Get signals as a stream: https://docs.rs/signal-hook-tokio/0.3.0/signal_hook_tokio/
Related Issues
Design and implement graceful shutdown for Zebra #1678
The text was updated successfully, but these errors were encountered: