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

オープン
#135 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
72/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
bun, node.js, typescript
領域
backend

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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

主要言語
TypeScript
スター
1
フォーク
0
平均マージ
17時間 25分
マージ済み PR(30日)
11

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

NanoForge-dev/Loader のほかの issue

NanoForge-dev/Loader の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。