Bun.serve: close the listen socket in finalize() so worker terminate releases the port - #36094
Closed
robobun wants to merge 5 commits into
Closed
Bun.serve: close the listen socket in finalize() so worker terminate releases the port#36094robobun wants to merge 5 commits into
robobun wants to merge 5 commits into
Claude / Claude Code Review
completed
Jul 29, 2026 in 34m 52s
Code review found 1 potential issue
Found 1 candidates, confirmed 1. See review comments for details.
Details
| Severity | Count |
|---|---|
| 🔴 Important | 0 |
| 🟡 Nit | 1 |
| 🟣 Pre-existing | 0 |
| Severity | File:Line | Issue |
|---|---|---|
| 🟡 Nit | src/runtime/server/server_body.rs:2775 |
schedule_deinit() now reachable from lastChanceToFinalize enqueues never-drained tasks |
Annotations
Check warning on line 2775 in src/runtime/server/server_body.rs
claude / Claude Code Review
schedule_deinit() now reachable from lastChanceToFinalize enqueues never-drained tasks
Nit: now that `finalize()` clears `listener`/`h3_listener` before `deinit_if_we_can()`, the block at `mod.rs:1750` is entered from `lastChanceToFinalize()` with `js_value == Finalized` and reaches `schedule_deinit()` (mod.rs:1774), which `vm.enqueue_task()`s two `ManagedTask`s that no event-loop tick will ever drain — `EventLoop::deinit()` drops them without running the callbacks, so `app.close()` / `Self::deinit(this)` still never run. Not a regression (the `NewServer`/`App` leaked pre-PR too;
Loading