Bun.connect: native write() returns -1 (not raw -errno) on a peer RST and close carries ECONNRESET - #36422
Open
robobun wants to merge 12 commits into
Open
Bun.connect: native write() returns -1 (not raw -errno) on a peer RST and close carries ECONNRESET#36422robobun wants to merge 12 commits into
robobun wants to merge 12 commits into
Claude / Claude Code Review
completed
Jul 30, 2026 in 28m 53s
Code review found 4 important issues
Found 2 candidates, confirmed 4. See review comments for details.
Details
| Severity | Count |
|---|---|
| 🔴 Important | 4 |
| 🟡 Nit | 0 |
| 🟣 Pre-existing | 0 |
| Severity | File:Line | Issue |
|---|---|---|
| 🔴 Important | src/runtime/socket/socket_body.rs:2969-2971 |
internal_flush latch double-reports via client SocketHandlers2.close (no _hadError guard) |
Annotations
Check failure on line 2971 in src/runtime/socket/socket_body.rs
claude / Claude Code Review
internal_flush latch double-reports via client SocketHandlers2.close (no _hadError guard)
The PR description says "node:net already guards its close-error path with `_hadError`", but that is only true for the server-side `SocketEmitEndNT` (net.ts:613) — the **client-side** `SocketHandlers2.close` at net.ts:1314 checks only `!self.destroyed`, not `_hadError`. With `internal_flush` now latching `fatal_write_errno` (6b03bd23), a node:net client whose **buffered** flush hits a fatal send goes: `on_writable` → `SocketHandlers2.error` (sets `_hadError`, defers destroy via `nextTick`) → syn
Loading