Repository navigation
fix(run): a stop during a restart in place stops hex cleanly - #493
Open
AVGVSTVS96 wants to merge 1 commit into
Open
AVGVSTVS96 wants to merge 1 commit into
AVGVSTVS96 wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
A restart in place starts bin/hex run over as the pid state/hub.pid names, and ran the login shell before setting its stop handler, so a hex stop that came then killed it with SIGTERM (143) and left state/hub.pid behind. The handler is now set first, and removes the pidfile only when it names this hex.
AVGVSTVS96
force-pushed
the
fix/stop-during-startup
branch
from
November 18, 2026 21:03
c1eb999 to
cdf87fa
Compare
This branch was successfully deployed
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.
A
hex stopthat comes while a restart in place is still starting killed hex outright: it exited 143 and leftstate/hub.pidbehind. Found while fixing a test's timing (#492).What happened
hex runruns the owner's login shell first and set its stop handler only after. A fresh start can't be stopped that early, sincehex stopneedsstate/hub.pid, written later. A restart in place can: it startsbin/hex runagain under the pid that file already names, so a stop during the login shell reached a hex with no handler.It doesn't reach a hex under systemd, where
hex stopgoes throughsystemctl. It does where there is none.The change
The handlers are set first thing in
run, and the stop removes the pid file only when it names this hex, so a second hex stopped early doesn't delete the running one's:A stop that lands during the login shell now waits for that shell to end, up to its 10 second limit, before hex exits.
The test
Without the change it fails with 143 in 2 seconds. With it, it passes in 4.
Checked
bin/hex.run.test.ts(25) andbin/hex.restore.test.ts(15).Not checked
/bin/shis dash, or macOS. Here/bin/shis bash.