Skip to content

node:net: keep the process alive while an early-unref'd/paused socket is still connecting - #39856

Merged
Jarred-Sumner merged 4 commits into
mainfrom
claude/net-unref-before-connect
Aug 22, 2026
Merged

Jarred-Sumner merged 4 commits into
mainfrom
claude/net-unref-before-connect

test: don't require the paused client to cross its high-water mark be…

bfbfe8e
Select commit
Loading
Failed to load commit list.
Claude / Claude Code Review completed Aug 21, 2026 in 19m 23s

Code review found 1 potential issue

Found 2 candidates, confirmed 1. See review comments for details.

Details

Severity Count
🔴 Important 0
🟡 Nit 1
🟣 Pre-existing 0
Severity File:Line Issue
🟡 Nit test/js/node/net/node-net.test.ts:780-783 Missing 'unref(); ref()' before-connect() row (robobun feedback unaddressed)

Annotations

Check warning on line 783 in test/js/node/net/node-net.test.ts

See this annotation in the file changed.

@claude claude / Claude Code Review

Missing 'unref(); ref()' before-connect() row (robobun feedback unaddressed)

The `ref() after unref()` it.each only covers 'right after connect()' and 'while the connect is in flight' — robobun's last comment (closing #37087) asked for the missing `s.unref(); s.ref();` *before* `connect()` row, which exercises the distinct `_handle === null` path (kUserUnrefed + once('connect') handlers + initSocketHandle) rather than js_ref/js_unref on a native handle. One more row: `["before connect()", 's.unref(); s.ref(); s.resume(); s.connect(port, "127.0.0.1");']`.