fix(loader-server): a watch restart forks the new worker before the old one exits

Offen
#135 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
72/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
bun, node.js, typescript
Bereich
backend

Rechercherichtung

Start with apps/server/src/server.ts at the cited restart path, then trace how the child worker is forked and how restart is triggered. Check the project’s existing process and logging tests, if present. Done means restart waits for the old worker to exit before forking, kills it after a timeout if needed, and logs child exit and error events.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

app:server bug
Which app is this bug report for?

server

Issue description

On restart, child.kill() only sends SIGTERM and fork runs right after (server.ts#L43-L50).

  • If the old game server still holds its port (4444/4445 in nf new --server projects), the new worker fails with EADDRINUSE.
  • If a game ignores SIGTERM, the old worker is never killed.
  • No exit/error handler is attached to the child, so worker crashes go unreported (the editor isn't told either).

Found by reading the code path (not reproduced).

Expected: the new worker starts only once the old one has exited, and worker exits and errors are logged.

Suggested fix: wait for the old child's exit event (SIGKILL after a timeout) before forking, and log exit and error.

Found during a read-only audit of main @ 044c766 (2026-11-11).

Code sample
if (child) {
  child.kill();          // SIGTERM, not awaited
  child = undefined;
}
child = fork(join(dirname(__filename), "worker.js"), ...);
Versions
  • @nanoforge-dev/loader-client / @nanoforge-dev/loader-server / @nanoforge-dev/loader-website 1.7.0 (main @ 044c766)
  • Bun 1.3.14
  • Linux x86_64
Issue priority

Medium (should be fixed soon)

I have tested this issue on a development release

044c766

Vorherrschende Sprache
TypeScript
Sterne
1
Forks
0
Ø Merge
17 Std. 25 Min.
Gemergte PRs (30 T.)
11

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus NanoForge-dev/Loader

Alle Issues in NanoForge-dev/Loader

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.