Repository navigation
fix(server): stop the launcher dying to a signal while it starts - #588
Merged
Merged
Conversation
Unit tests failed on CI for every push since #585, and a diff test failed now and then before that. The launcher test failed every time on CI and never locally. stopOnSignals asked ps three times whether its parent was a bun runner before it installed any signal handler. Until a handler exists a signal takes its default action, so SIGHUP or SIGINT in that window killed the supervisor outright and left the server running with nothing to restart it. A slower runner made the window wider than the server's start-up, which is when the test sends SIGHUP. The handlers are now installed first and ps runs last; a signal that arrives meanwhile waits for its handler. With ps slowed by 300 ms the test failed every run before the change and passes after. The diff invariant test diffed a fully reversed 20,000-line file, Myers' worst case. That took 3 to 5 s against bun's 5 s timeout, so it passed or failed with the runner's load. The case keeps its shape at 4,000 lines; the invariant does not depend on size, and the diff runs in a worker in the app. The git identity test read the developer's own name when run from a shell Clopen started: GIT_CONFIG_COUNT/KEY_n/VALUE_n outrank every config file. The test now drops them.
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.
Summary
Makes Unit Tests pass on CI again. The launcher test has failed on every push since #585, and a diff test failed now and then before that. 0.4.50 was retracted because of this and will be re-cut once this is merged.
Why
stopOnSignalsranpsthree times (parentForwardsSignals) before it installed any signal handler. Until a handler exists, a signal takes its default action, so a SIGHUP or SIGINT in that window killed the supervisor outright. The server kept running with nothing to restart it. On a slower runner the window outlasted the server's start-up, which is exactly when the test sends SIGHUP. This is a real bug, not only a test bug: a Ctrl+C or a closed terminal during launch could leave an orphaned server.GIT_CONFIG_COUNT/KEY_n/VALUE_n(which outrank every config file) supplied the developer's own identity.Changes
shared/utils/process-supervisor.ts: install every handler first and runparentForwardsSignals()last. A signal that arrives meanwhile is queued, and its handler sees the right value.frontend/utils/line-diff.test.ts: the reversed case now uses 4,000 lines (~150 ms instead of 3 to 5 s). The invariant does not depend on size, and in the app the diff runs in a worker.backend/git/identity/scope-config.test.ts: stripGIT_CONFIG_COUNT/KEY_n/VALUE_nbefore calling git.Test plan
bun run check,bun run lintbun run test: 1986 pass, 0 failpsthat sleeps 300 ms on PATH. Before the change the launcher test failed at the same line as on CI (process-supervisor.test.ts:233); after it, 3/3 runs pass.Notes
CI installs
bun-version: latest(1.4.4 today) while local is 1.3.14. That was not the cause here, since the test passes on 1.4.4 in Docker, but it is a source of drift worth pinning separately.