Hard-exit the neuron when its forward loop stalls - #723
Closed
LandynDev wants to merge 1 commit into
Closed
Conversation
LandynDev
force-pushed
the
vali/hard-exit-on-stall
branch
from
September 5, 2026 02:19
fcaefce to
38746c2
Compare
Collaborator
Author
|
Closing: the fix belongs on the RPC connection (timeout + reconnect on the vault poll, #724), not a hard-exit workaround. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The stall watchdog in neurons/validator.py and neurons/miner.py calls sys.exit(1), but a stalled forward thread is wedged inside a socket read that never returns. The interpreter then waits for that thread at shutdown (concurrent.futures atexit join), so the process never exits, docker's restart policy never fires, and the neuron sits dead with the container reported Up.
Seen three times on the testnet validator today: the relay's vault event poll blocks forever in websockets recv under async_substrate_interface (stack in the linked issue), the watchdog logs "exiting for restart", the thread stops, the process stays alive.
exit_for_restart() logs, arms a daemon Timer that calls os._exit(1) after 30 s, then raises SystemExit so the normal cleanup still runs when it can. Both neurons use it for the dead-thread and stalled-forward cases.
Stopgap only. The root cause (no read timeout on the vault subtensor websocket in allways/vault/client.py poll_events) is filed separately.