|
| 1 | +--- |
| 2 | +"@aws-blocks/core": patch |
| 3 | +--- |
| 4 | + |
| 5 | +fix(core): robust dev server — startup port reclaim, singleton guard, and :3000 EADDRINUSE handling |
| 6 | + |
| 7 | +Hardens the local dev server against the port-contention failure modes that |
| 8 | +survived PR #80 (which fixed only single-supervisor frontend self-restart): |
| 9 | + |
| 10 | +- **Startup reclaim** — a fresh `server.ts` now frees a stale `:3000`/`:3100` |
| 11 | + listener left by a crashed or `SIGKILL`'d predecessor before it binds the |
| 12 | + front door / spawns the `--strictPort` frontend, instead of relying on the |
| 13 | + previous process's `cleanup()` finishing within tsx-watch's ~5s window. |
| 14 | +- **Singleton guard** — a per-port pidfile stops a second `npm run dev` from |
| 15 | + spawning a competing supervisor that fights the first over `:3000`/`:3100`; it |
| 16 | + exits cleanly with a clear message. A stable-parent (`tsx watch`) carve-out |
| 17 | + keeps hot reload working, and a dead-owner pidfile never blocks startup. |
| 18 | +- **`:3000` EADDRINUSE robustness** — the backend front door now emits a real |
| 19 | + console error (not only telemetry), reclaims the stale owner and retries the |
| 20 | + bind (bounded), and exits non-zero with a clear message on unrecoverable |
| 21 | + failure, so a contended `:3000` never silently fails to serve. |
| 22 | + |
| 23 | +Reuses the existing `waitForPortFree` / process-group-kill primitives (plus an |
| 24 | +`lsof`/`netstat` listener probe mirroring the `cleanup` script) — no new |
| 25 | +teardown mechanism. `--strictPort` is retained for local dev, made safe by the |
| 26 | +startup reclaim guaranteeing `:3100` is free first. |
0 commit comments