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

Abierto
#135 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
72/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
bun, node.js, typescript
Área
backend

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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

Lenguaje dominante
TypeScript
Estrellas
1
Forks
0
Merge medio
17 h 25 min
PR fusionados (30 d)
11

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de NanoForge-dev/Loader

Todos los issues de NanoForge-dev/Loader

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.