Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Dev session cannot be killed: forceExit crashes on undefined `pipeline`, orphan watchdog loops forever

Aperta
#507 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
55/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
backend, cli

Direzione di ricerca

Read packages/everything-dev/src/services/dev/session.ts around forceExit and pipeline creation, then inspect orchestrator.ts and the orphan watchdog. Reproduce by starting bos dev and killing its parent process. Done means the session exits cleanly on orphaning or repeated SIGINT without a recurring exception; the issue does not name a test to run.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug

Symptoms

Killing a running bos dev session (or orphaning it via the parent/wrapper dying) leaves a zombie orchestrator that spams this every 200ms and never exits:

[Dev] Parent process died — force exiting (orphaned service tree)
[Orchestrator] Uncaught exception: ReferenceError: pipeline is not defined
    at forceExit (.../dist/services/dev/session.mjs:237:3)
    at Timeout._onTimeout (.../session.mjs:246:4)

^C is also swallowed: the second SIGINT escalates into the same broken forceExit, so even repeated ^C just re-prints the error. Only an external SIGKILL (or closing the terminal) ends it.

Root cause — three stacked bugs

1. forceExit references pipeline out of scope — packages/everything-dev/src/services/dev/session.ts:

const forceExit = () => {
    controls?.restoreView();
    // @ts-ignore
    pipeline.flush();          // ← ReferenceError at runtime
    console.log("\n[Dev] Force exit");
    controls?.emergencyKill(); // ← never reached
    process.exit(0);           // ← never reached
};

pipeline is created inside the session's Effect.gen block (session.ts:182, per-fiber log pipeline); forceExit is defined at the outer wrapper scope where it does not exist. The // @ts-ignore silences the type error but not the runtime one. The crash happens before emergencyKill() and process.exit(0).

2. The orchestrator swallows the crash — orchestrator.ts:20 registers process.on("uncaughtException", (err) => console.error(...)), so the ReferenceError is logged and the process survives instead of dying.

3. The orphan watchdog re-arms forever — a 200ms setInterval compares process.ppid against the initial value and calls the broken forceExit on every mismatch → infinite crash/log loop.

Introduced

fbe6c6ff (2026-10-19, "refactor(everything-dev): domain-folder layout, Effect-native CLI split, dev-render DIP", #476) — the pipeline.flush() call in forceExit came with that refactor's scope reshuffle. Shipped in [email protected].

Repro

  1. bos dev in any v2 child app (observed on a v2-upgraded child running the rc.14 CLI).
  2. Kill the parent/wrapper process (or let it die) so the orchestrator is reparented.
  3. Watch the 200ms crash loop; ^C does not help.

Fix direction

  • Hoist the pipeline (or an activePipeline handle) to the wrapper scope — assign when created, clear at teardown — and make the kill unconditional:
const forceExit = () => {
    try { controls?.restoreView(); } catch {}
    try { activePipeline?.flush(); } catch {}
    console.log("\n[Dev] Force exit");
    try { controls?.emergencyKill(); } catch {}
    process.exit(0);
};
  • Belt-and-braces in orchestrator.ts: if an uncaught exception fires while a force-exit is in flight, process.exit(1) instead of swallowing it.

Workaround until fixed

External kill path (never goes through the in-process forceExit): bos kill --all, or pkill -9 -f "everything-dev.*dev".

Lingua principale
TypeScript
Stelle
5
Fork
3
Merge medio
11h 8m
PR unite (30g)
90

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di NEARBuilders/everything-dev

Tutte le issue di NEARBuilders/everything-dev

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.