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

Ouverte
#135 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
3/5
Temps estimé
1-2 jours
Accessibilité débutants
72/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
Active
Stack technique
bun, node.js, typescript
Domaine
backend

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

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

Langage dominant
TypeScript
Étoiles
1
Forks
0
Merge moyen
17 h 25 min
PR mergées (30 j)
11

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de NanoForge-dev/Loader

Toutes les issues de NanoForge-dev/Loader

Issues similaires

Plus d'issues TypeScript

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.