Repository navigation
Conversation
…ponse meta-commands.ts called await shutdown() before returning the HTTP response, tearing down the listener so the response never flushed. The CLI saw ECONNRESET, crash-retry re-sent the command, and the daemon logged 'crashed twice in a row' before exit. Fix: defer shutdown() via setTimeout(0) so the response flushes first. Added regression tests for both stop and restart commands. Version bump: 1.32.0.0 → 1.32.0.1
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
|
@16francej — recommend closing this PR. It is superseded by #1732 because its timer-ordering test does not show that a real HTTP response is flushed before exit. Credit #2020 for the response-ordering idea, while requiring bounded response-body, process-identity, state, and restart-behavior coverage in #1732. |
|
Thanks for this, @devkd111. The fix is now on main: the daemon sends the stop/restart response and shuts down 25ms later (browse/src/meta-commands.ts) (fixed in v1.65.0.0, #2577). Closing as superseded; if you still see the problem on the latest gstack, please open an issue with ./setup --status output. |
Problem
meta-commands.tscase'stop'and'restart'callawait shutdown()BEFORE returning the HTTP response.shutdown()tears down the HTTP listener and callsprocess.exit(), so the response never flushes. The CLI seesECONNRESET, its crash-retry logic re-sends the command, and the daemon logs "crashed twice in a row" before exit.Fix
Replace
await shutdown()withsetTimeout(() => { shutdown(); }, 0)in both'stop'and'restart'cases. This defers the shutdown until after the current execution context completes, allowing the HTTP response to flush before the listener is torn down.Test
Added regression tests in
browse/test/commands.test.ts:Server Control > stop returns response before shutdown fires— verifies shutdown calls are deferred (not synchronous)Server Control > restart returns response before shutdown fires— same for restartServer Control > status returns healthy— baselineAll 226 existing tests pass, zero regressions.
Files changed
browse/src/meta-commands.ts— defer shutdown via setTimeout(0)browse/test/commands.test.ts— regression tests (3 new, 226 total pass)VERSION— bump 1.32.0.0 to 1.32.0.1package.json— bump 1.32.0.0 to 1.32.0.1CHANGELOG.md— entry for 1.32.0.1