Skip to content

fix(cli): report a signal-killed indexer and exit like a shell - #3279

Open
johnhldiver-beep wants to merge 1 commit into
colbymchenry:mainfrom
johnhldiver-beep:fix/3277-signal-exit-code
Open

johnhldiver-beep wants to merge 1 commit into
colbymchenry:mainfrom
johnhldiver-beep:fix/3277-signal-exit-code

Conversation

@johnhldiver-beep

Copy link
Copy Markdown

Closes #3277

Problem

When the indexer that the CLI relaunches with the WASM runtime flags is killed
by a signal — most often an out-of-memory kill — codegraph init and
codegraph index exit 1 and print nothing. relaunchWithWasmRuntimeFlagsIfNeeded
dropped result.signal, so a killed indexer looked like an ordinary failure,
and the exit code didn't say a signal was involved.

Fix

In src/extraction/wasm-runtime-flags.ts, when the relaunched child was killed
by a signal, name it on stderr:

codegraph: the indexer was killed by SIGKILL (out of memory?)

and exit with 128 + the signal number (137 for SIGKILL), as a shell would, so
scripts and CI can tell a kill from a failure.

Verified (disk/log-verified)

  • Failing test first: before the fix, a SIGTERM/SIGKILL-killed relaunched
    child exited 1 with no stderr (cg3277-test1.log).
  • After the fix: wasm-runtime-flags.test.ts passes 13/13 — SIGTERM →
    exit 143 with killed by SIGTERM, SIGKILL → exit 137 with killed by SIGKILL (out of memory?) (cg3277-test2.log).
  • Full npm test suite: 10523 passed / 2 failed, both known pre-existing
    (untracked TypeScript: a call to a global like parseInt or new Response() links a project export of that name the file doesn't import #3238 handover test + ui-server-api busiest symbol, fanIn 33)
    (cg3277-full.log).
  • npm run build exits 0 (cg3277-build2.log).
  • Sweep: no other site on the CLI indexer exit path drops result.signal.
    The upgrade spawnSync helpers (defaultRun/defaultCapture,
    remove-binary.ts) return numeric codes rather than deciding process.exit,
    and are a different concern, so they were left out of this one-concern diff.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CLI: an indexer killed by a signal (out of memory) exits 1 with no message

1 participant