fix(loader-server): the worker fails to start with E2BIG when the game has about 1,500 files or more

Offen
#133 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
73/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
bun, typescript
Bereich
backend

Rechercherichtung

Start with apps/server/src/server.ts lines 49–53 and apps/server/src/worker.ts line 8 to trace how the file map reaches the worker. Compare the proposed IPC and temporary JSON file approaches, then check the worker startup and watch mode paths. Done means the server starts with around 1,500 files or more, including in watch mode, without an E2BIG error.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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

server

Issue description

The server loader passes the whole file map to the worker as one argv string (server.ts#L49-L53, read in worker.ts#L8). On Linux, a single argument is limited to 128 KiB (MAX_ARG_STRLEN). With ordinary paths, the limit is reached at roughly 1,200 to 1,500 files: fork throws and the game server never starts. In watch mode the throw happens inside the watcher callback, as an unhandled rejection.

Reproduced with fork under Bun 1.3.14, using paths shaped like the loader's [virtualPath, absolutePath] pairs:

1000 files  108781 chars  exit 0
1500 files  164281 chars  THROW E2BIG: argument list too long, posix_spawn '…/bun'

Expected: the server starts whatever the number of files.

Suggested fix: send the paths over the IPC channel (child.send) or a temp JSON file instead of argv, and have the worker read them before calling main.

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

Code sample
child = fork(
  join(dirname(__filename), "worker.js"),
  [mainPath as string, JSON.stringify(paths)], // one argv entry, grows with the file count
  { env: ... },
);
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

High (immediate attention needed)

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.