Repository navigation
Conversation
|
Updated 1:54 PM PT - Jul 17th, 2026
❌ @robobun, your commit 3360579 has 2 failures in
🧪 To try this PR locally: bunx bun-pr 34161That installs a local version of the PR into your bun-34161 --bun |
|
Found 3 issues this PR may fix:
🤖 Generated with Claude Code |
|
Checked the bot's suggestions:
Keeping the PR scoped to #34158, which is verified fixed on Windows and has a cross-platform regression test. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughChangesAdded Bun and Node HTTP shutdown regression tests covering aborted or half-closed requests, and removed Windows quarantine entries for related HTTP scenarios. Server shutdown lifecycle
Possibly related issues
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@test/regression/issue/34158.test.ts`:
- Around line 36-41: Replace the fixed 50ms setTimeout in the net.connect
callback with synchronization on the actual request-start condition, awaiting
confirmation that the server has begun handling the request before destroying
the client. Preserve the test’s intended client-disconnect behavior and avoid
introducing any timer-based sequencing.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: e790afa3-2395-4921-a6b9-062c55b93b0a
📒 Files selected for processing (3)
src/runtime/server/mod.rstest/expectations.txttest/regression/issue/34158.test.ts
💤 Files with no reviewable changes (1)
- test/expectations.txt
There was a problem hiding this comment.
Both prior nits (H3-branch guard, redundant unref() in deinit_if_we_can) are addressed in 2bd97c7 and I found nothing new. Deferring to a human for sign-off given this changes event-loop ref release timing in the server shutdown path — the same area where #32488's attempts regressed.
What was reviewed:
stop_listeningguardsunref()onabrupt || pending_requests == 0for both TCP and H3 arms; deferred release indeinit_if_we_canfires fromon_request_complete→pending_requests -= 1→deinit_if_we_can()(mod.rs:1440-1441).- Confirmed the WS-independent unref gate can't strand the ref:
has_listener()is already false at that point andKeepAlive::unrefis idempotent. - Regression test's
setTimeout(dropClient, 50).unref()is now sequenced from inside the handler; the unref'd timer is the property under test, not a wait-for-time probe. expect(stderr).toBe("")was flagged and ruled out —bunEnvquiets debug logs and no ASAN-gated skip is needed for this test.
Extended reasoning...
Overview
The PR changes two functions in src/runtime/server/mod.rs: stop_listening() now defers releasing the server's KeepAlive loop ref on graceful stop when pending_requests > 0, and deinit_if_we_can() releases it once requests drain (independent of active WebSockets). It adds a two-case regression test and un-quarantines a Windows entry in test/expectations.txt. The diff to deinit_if_we_can() is mostly re-indentation from nesting the existing !has_active_web_sockets() block inside the new outer gate; the substantive change is ~10 lines.
Security risks
None identified. No user input parsing, auth, or crypto is touched. The change gates when an existing idempotent unref() call fires; it does not introduce new resource acquisition or expose new surface area.
Level of scrutiny
High. This is production-critical server lifecycle code that governs whether the process stays alive after server.stop() / server.close(). Getting it wrong in one direction wedges Windows processes forever (the bug being fixed); getting it wrong in the other direction leaks a loop ref and prevents clean exit (what #32488's attempt 3 did with the WS-gated variant). The PR description explicitly documents that history, and the fix is deliberately narrower than the prior attempts, but this is exactly the class of change where a maintainer familiar with the pending_requests / active_tasks / uv-ref accounting should confirm the invariant.
Other factors
- My two prior inline comments (H3 else-branch unguarded, redundant
unref()made dead) were both addressed in commit 2bd97c7 via a sharedshould_unref_nowlocal and folding the outer gate. Verified in the current diff. - I traced the deferred-release path:
on_request_complete()(mod.rs:1435) andon_static_request_complete()(mod.rs:1429) both decrementpending_requestsand calldeinit_if_we_can(), so the held ref is released when the last in-flight request completes.stop()also callsdeinit_if_we_can()at mod.rs:1590 for the zero-pending case. - One pre-existing site at
server_body.rs:2788decrementspending_requestswithout callingdeinit_if_we_can()(a synchronous dev-tools JSON handler). It's synchronous native code whereserver.stop()can't interleave, so it's not affected by this change — noting it only as pre-existing. - The regression test's
expect(stderr).toBe("")pattern was raised by a finder and ruled out;bunEnvsetsBUN_DEBUG_QUIET_LOGS=1. The unref'dsetTimeoutin the first test case is intentional per the author's reply — it's the observable that distinguishes fixed from unfixed, not a timing probe. - CI build #72920 is in progress; no results visible yet in the timeline.
There was a problem hiding this comment.
Both nits from my earlier pass are addressed in 2bd97c7 (the H3-only arm now shares the should_unref_now guard, and the redundant unref() in deinit_if_we_can is gone). I didn't find anything further, but this reworks the server's event-loop KeepAlive release timing across graceful stop — subtle enough (and with a prior failed attempt in #32488) that a maintainer familiar with the server lifecycle should sign off.
What was reviewed:
stop_listening: both TCP and H3 arms now deferunref()on graceful stop with pending requests; abrupt stop still unrefs immediately.deinit_if_we_can: the deferredunref()gates onpending_requests == 0 && !has_listener()only — checked that excludinghas_active_web_sockets()is deliberate (WS close never reaches this function) so a stopped server with only WS connections doesn't hold the ref forever.- Confirmed
KeepAlive::unrefis a status flag, not a counter — the extra call fromdeinit_if_we_canafterstop_listeningalready unref'd is a no-op, and the user-facingserver.unref()path is unaffected.
Extended reasoning...
Overview
The PR changes when NewServer releases its KeepAlive loop ref during a graceful stop()/server.close(). Previously stop_listening() unconditionally called self.unref(); now it defers when !abrupt && pending_requests > 0, and deinit_if_we_can() releases it once the last request drains. The H3-only listener arm gets the same guard via a shared should_unref_now local. A regression test covers both Bun.serve (POSIX-observable early-exit) and node:http (Windows wedge), and the Windows quarantine entry for the original half-close test is removed.
Security risks
None identified. This is event-loop refcounting during shutdown; no auth, crypto, or untrusted-input parsing is touched.
Level of scrutiny
High. src/runtime/server/mod.rs is production-critical, and KeepAlive ref balance errors fail in two directions: hold too long → process never exits (the #32488 attempt-3 failure mode with ws-upgraded connections, which is why the new gate deliberately excludes has_active_web_sockets()); release too early → Windows uv_run stops polling and in-flight requests wedge (the #34158 bug). The reasoning that ServerWebSocket::on_close never reaches deinit_if_we_can() is load-bearing for the gate shape and deserves a maintainer's confirmation.
Other factors
- My two prior inline nits (H3 sibling arm unguarded; now-dead second
unref()) were both applied in 2bd97c7, and CodeRabbit's setTimeout-sequencing concern was addressed by moving the client-destroy schedule inside the handler. - The regression test asserts
stderr === "", which CLAUDE.md warns against for ASAN/debug noise, but the PR's own evidence shows it passing on the ASAN debug pipeline, so not flagging it. - The fix is narrow and well-argued, with fails-before/passes-after evidence on both Linux and Windows and a broad set of adjacent tests re-run. I'm deferring purely on the criticality of the code path, not on any identified defect.
|
CI on build 72927 is red on unrelated lanes only (all classified flaky/pre-existing by the scraper, plus two darwin one-offs: |
b8864c3 to
77c02b2
Compare
There was a problem hiding this comment.
Beyond the inline nit: verified that hoisting should_unref_now above self.listener.take() is behavior-preserving for the TCP arm (the condition reads only pending_requests / has_active_web_sockets(), neither touched by take()), and that the deferred release in deinit_if_we_can() covers the H3-only defer (has_listener() checks h3_listener, already taken at that point). Leaving final sign-off to a human since this is server shutdown ref-counting and the H3-only arm itself isn't exercised by the new test.
Extended reasoning...
The Rust change hoists the existing #32488 guard into a should_unref_now local and applies it to the sibling H3-only branch of stop_listening(). I traced both arms: the TCP arm's semantics are unchanged (the hoisted condition's inputs are not mutated by listener.take() or the preceding h3_listener.take()/h3_app.close()), and the H3-only arm's deferred unref completes via deinit_if_we_can() at line ~1681 since has_listener() is false once both listeners are taken. The expectations.txt change is a pure stale-comment deletion. All prior review threads (mine and CodeRabbit's) are resolved in the current revision. Not auto-approving because this is critical-path server lifecycle code and, per the PR description, the H3-only arm being fixed has no direct test coverage.
bcab491 to
bafc6fe
Compare
There was a problem hiding this comment.
LGTM — test-only regression coverage for a fix that already landed in #32488, plus removal of an orphaned expectations.txt comment block. All prior review nits (combined-object assertion, test.concurrent, timer sequencing) have been applied.
What was reviewed:
- Both subprocess tests drain stdout/stderr/exited concurrently and assert as a combined object;
await usinghandles cleanup. - The unref'd
setTimeout(dropClient, 50)is armed from inside the fetch handler afterserver.stop(), so there's no arrival race;dropClientis assigned synchronously before any async callback can read it. - The expectations.txt deletion is a stale comment only — the quarantine line it described was already removed by #32488.
Extended reasoning...
Overview
This PR adds test/regression/issue/34158.test.ts with two test.concurrent subprocess cases guarding the server-teardown fix that merged in #32488, and removes a 7-line orphaned comment block from test/expectations.txt (the [ WINDOWS ] quarantine entry it described was already deleted by #32488, leaving the comment attached to nothing). No runtime code is touched — earlier revisions of this PR carried the src/runtime/server/mod.rs change, but that has since merged separately and been dropped from the diff.
Security risks
None. Test-only change spawning bunExe() subprocesses that bind 127.0.0.1:0; no external network, no auth/crypto/permissions surface.
Level of scrutiny
Low-to-moderate — the concern with regression tests is flakiness and whether they fail for the right reason. Both were examined:
- Test 1 (Bun.serve): the client destroy is scheduled via an unref'd timer from inside the fetch handler, after
server.stop(). The author explained (and CodeRabbit accepted) that the unref'd timer is itself the mechanism under test — whether the server's held ref keeps the loop alive long enough for it to fire.dropClientis assigned synchronously before the connect callback or fetch handler can run, sosetTimeout(dropClient, 50)never seesundefined. Theprocess.on("exit")reporter distinguishesSAW_ABORTfromEXITED_EARLY, so a regression produces a clear diff rather than a hang. - Test 2 (node:http): awaits
"listening"viaonce(), awaitsserver.close()via its callback, usesBuffer.allocUnsafefor the 10 MB body per harness conventions. On regression this would hang and hit the test timeout, which is the intended failure mode for the Windows wedge case.
Both tests use bunEnv/bunExe(), port: 0, await using proc, concurrent pipe draining via Promise.all, and a single combined { stdout, stderr, exitCode } assertion.
Other factors
Three rounds of review nits from prior runs (setTimeout sequencing, exact-empty-stderr assertion, test.concurrent) were each addressed in follow-up commits and all threads are resolved. The author reported CI green for this test on every lane that ran it (build 72927). The expectations.txt change is a pure comment deletion with no effect on which tests run.
bafc6fe to
d825f18
Compare
There was a problem hiding this comment.
LGTM — test-only regression coverage for a fix that already merged in #32488; both remaining inline findings are polish nits (stale EOF comment in expectations.txt, spawn timeout:/signalCode on the hang-guard case) and don't block.
Extended reasoning...
Overview
This PR is now test-only: it adds test/regression/issue/34158.test.ts (two subprocess-spawning cases guarding the server.stop()/server.close() KeepAlive-ref fix that landed in #32488) and removes one stale comment block from test/expectations.txt. Earlier revisions carried src/runtime/server/mod.rs changes; those merged separately and my prior inline comments on them are resolved.
Security risks
None. No production code is touched. The tests bind port: 0 on 127.0.0.1 inside a child process, contact no external hosts, and write no files.
Level of scrutiny
Low-to-moderate. The runtime fix is already on main; this PR only adds coverage. The tests follow harness conventions closely — bunEnv/bunExe, await using on the spawn, concurrent Promise.all pipe drain, combined {stdout, stderr, exitCode} assertion, test.concurrent — all of which were applied in response to earlier review rounds on this PR.
Other factors
All four of my prior inline comments (dead unref(), H3 else-arm, separate stderr assertion, test.concurrent) were addressed and are marked resolved. CodeRabbit's setTimeout-sequencing concern was also addressed by moving the timer arm inside the fetch handler. CI is green on the target lanes per the author's build-74490 note. The two findings this run are explicitly nits: one is a second orphaned comment block at EOF of expectations.txt (pure comment hygiene, zero runner impact), the other is adding a spawn timeout: + signalCode to the hang-guard test to match sibling regression files — diagnostic quality only, the test still fails on regression without it. Neither affects correctness, so I'm approving; the author can fold them in or leave for a follow-up.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@test/regression/issue/34158.test.ts`:
- Line 60: Relax the subprocess result assertions in
test/regression/issue/34158.test.ts at lines 60-60 and 110-115 by matching
stderr with expect.any(String) instead of requiring an empty string; keep the
stdout and exitCode expectations unchanged at both sites.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 993f4160-82fa-4b2c-8163-209f582dca91
📒 Files selected for processing (2)
test/expectations.txttest/regression/issue/34158.test.ts
💤 Files with no reviewable changes (1)
- test/expectations.txt
There was a problem hiding this comment.
LGTM — test-only regression coverage plus stale-comment cleanup. The remaining inline note is a two-line consistency nit (test 1's spawn lacks the same timeout/signalCode guard applied to test 2 in 60799c3); non-blocking either way.
Extended reasoning...
Overview
This PR is now test-only: it adds test/regression/issue/34158.test.ts (two test.concurrent subprocess cases guarding the #32488 fix — Bun.serve graceful stop() with an in-flight request, and the canonical node:http half-close + server.close() wedge) and deletes two orphaned comment blocks from test/expectations.txt that #32488 left behind when it removed their quarantine entries. The runtime change that earlier revisions of this PR carried has already merged via #32488; the H3 sibling was split out per the PR description.
Security risks
None. No production code is touched. The expectations.txt diff is pure comment-line deletions — no quarantine entries are added or removed, so CI coverage is unchanged. The test spawns local subprocesses binding port: 0 on 127.0.0.1 with no external network contact.
Level of scrutiny
Low. Test-only additions plus comment hygiene in a runner-ignored section of expectations.txt. The test file has been through five rounds of review feedback (unref'd-timer sequencing, combined-object assertions, test.concurrent, second orphaned expectations block, hang-guard timeout/signalCode on test 2), each addressed and resolved. The tests follow the harness conventions closely: bunEnv/bunExe, await using proc, Promise.all pipe draining, port: 0, issue-URL header comment.
Other factors
The one open inline nit — test 1's spawn is missing the timeout: 10_000 + signalCode: null guard that 60799c3 added to test 2 — is a file-internal symmetry point with no correctness impact (test 1's regression mode is early-exit, not hang). CI is reported green on the latest build with the new test passing on all lanes that ran it. Approving; the nit can be taken or left.
There was a problem hiding this comment.
LGTM — test-only regression coverage plus stale-comment cleanup; all prior review nits have been applied.
What was reviewed:
- Both subprocess tests now follow the hang-guard convention (spawn
timeout: 10_000, combined{stdout, stderr, exitCode, signalCode}assertion,test.concurrent, pipes drained viaPromise.all). expectations.txtdeletions are comment-only; confirmed no live quarantine entries are removed and both orphaned #32488 comment blocks are now gone.- Checked test 1's client-drop sequencing (unref'd timer scheduled from inside the handler after
server.stop()) — the abort await is bounded by the parent spawn timeout, so a delivery gap fails with a clear diff rather than a runner timeout.
Extended reasoning...
Overview
The PR adds test/regression/issue/34158.test.ts (two test.concurrent subprocess cases guarding the #32488 fix for the server.stop()/server.close() loop-ref release) and deletes 11 comment-only lines from test/expectations.txt that #32488 left orphaned when it removed their quarantine entries. No runtime source is touched — an earlier revision that patched src/runtime/server/mod.rs was dropped after #32488 merged the fix independently.
Security risks
None. This is test-only: a new regression test file and comment deletions in the CI expectations manifest. No production code paths, no user-facing surface, no input handling.
Level of scrutiny
Low. Test additions and comment cleanup carry no correctness risk to the shipped binary. The review focus was harness-convention conformance (REVIEW.md's subprocess/hang-guard rules) and confirming the expectations.txt deletions remove only dead comments, not live entries — both hold.
Other factors
Four rounds of prior inline nits from earlier runs (combined-object assertion, test.concurrent, spawn timeout + signalCode: null, sibling orphaned comment block, spawn symmetry) were each applied in commits bcab491, bafc6fe, 60799c3, and a0700f1; every thread is resolved. The CodeRabbit expect.any(String) suggestion was correctly declined with a reasoned reply and withdrawn. The bug-hunting system found nothing on the current head. No human reviewer has outstanding comments. The PR description's evidence block shows the tests passing under debug/ASAN.
There was a problem hiding this comment.
LGTM — test-only regression coverage; all four prior review rounds have been addressed (combined-object asserts, test.concurrent, both orphaned expectations.txt comment blocks removed, and both spawns now bounded with timeout + signalCode: null, with the 30s bump for ASAN headroom in b593bb2).
Extended reasoning...
Overview
Test-only PR: adds test/regression/issue/34158.test.ts with two subprocess-spawned regression cases guarding the #32488 fix (Bun.serve graceful stop() keeping the loop ref while requests drain; node:http server.close() draining a half-closed connection), and removes two orphaned comment blocks from test/expectations.txt that #32488 left behind when it deleted their quarantine entries. No production code is touched — the runtime fix already landed in #32488 and this PR was rescoped to coverage-only after its earlier mod.rs changes were dropped.
Security risks
None. The change adds a test file and deletes comment lines from a CI expectations file. Both subprocess scripts bind port: 0 on 127.0.0.1 inside a child process spawned with bunEnv; no external hosts, no credentials, no filesystem writes.
Level of scrutiny
Low. Test-only, self-contained, follows the established test/regression/issue/ subprocess-spawn pattern (bunExe -e, await using proc, concurrent pipe drain via Promise.all, combined {stdout, stderr, exitCode, signalCode} assertion, bounded spawn timeout). The expectations.txt edits are pure comment deletions — the runner ignores comment lines, so there is no CI-coverage change.
Other factors
This PR has been through four prior review rounds from me, each addressed in a follow-up commit and marked resolved: combined-object assertions (bcab491), test.concurrent (bafc6fe), the second orphaned expectations.txt block + hang-guard timeout/signalCode on test 2 (60799c3), and symmetry on test 1's spawn (a0700f1). b593bb2 then widened both spawn timeouts to 30s for ASAN headroom. The CodeRabbit expect.any(String) suggestion was declined with a stated reason and CodeRabbit withdrew it. No outstanding comments remain. I re-checked test 1's dropClient assignment ordering — it's assigned synchronously before the async connect callback can fire, so the handler's setTimeout(dropClient, 50) always sees a defined function. The bug-hunting pass on the current revision found nothing.
b593bb2 to
60a6130
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@test/regression/issue/34158.test.ts`:
- Around line 90-97: Update the request flow in the regression test to use a
deliberately non-terminating or flow-controlled upload, keeping the request
active until the client cancellation is observed. Replace the blanket catch with
assertions that verify the request is aborted/cancelled for the expected reason,
and perform this verification before calling server.close(); retain the promise
check for write() returning true.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 10425766-16ce-42c0-8a6d-d8bbf0339bed
📒 Files selected for processing (2)
test/expectations.txttest/regression/issue/34158.test.ts
💤 Files with no reviewable changes (1)
- test/expectations.txt
There was a problem hiding this comment.
LGTM — test-only regression coverage; all prior review nits have been addressed.
What was reviewed:
- Both subprocess tests now use
test.concurrent, combined{stdout, stderr, exitCode, signalCode}assertions, and a 30s spawntimeoutwithsignalCode: null— the earlier asymmetry and hang-guard gaps are resolved. expectations.txtchange is comment-only (both #32488-orphaned blocks now removed); no quarantine entries touched, so no coverage change.- Checked the
dropClientassignment ordering in test 1 — it's set synchronously before any I/O can reach the handler, so no undefined-at-call race.
Extended reasoning...
Overview
Test-only PR adding test/regression/issue/34158.test.ts (two test.concurrent subprocess cases guarding the #32488 fix for the server.stop()/server.close() loop-ref release) and removing two stale comment blocks from test/expectations.txt that #32488 orphaned. No production code is touched — the runtime fix already landed in #32488.
Security risks
None. This adds test coverage and deletes comments. Both subprocesses bind port: 0 on 127.0.0.1 inside the child, no external hosts, no filesystem writes, no auth/crypto/permissions surface.
Level of scrutiny
Low. Test-only, follows established harness conventions (bunEnv/bunExe, await using, Promise.all for concurrent pipe drain, combined-object assertion, spawn-side timeout bound with signalCode: null). The expectations.txt edit removes only comment lines — the runner ignores comments, so CI test selection is unchanged.
Other factors
This PR has been through four review rounds; every inline comment I raised (combined-object assertion, test.concurrent, second orphaned expectations.txt block, spawn timeout + signalCode on both spawns) was applied and the threads resolved. The most recent commit (60a6130) widened the spawn timeout to 30s for ASAN headroom, which is reasonable given the debug/ASAN evidence showed ~2.5s per test. CodeRabbit's remaining suggestion (relax stderr to expect.any(String)) was declined with a sound rationale and withdrawn. The bug-hunting pass on the current revision found nothing.
The fix landed in #32488 (stop_listening holds the server's loop ref while pending_requests > 0 or active WebSockets exist; WS close now re-evaluates deinit_if_we_can so the deferred release completes). Adds a two-case subprocess regression test: - Bun.serve: graceful stop() with an in-flight async handler must not let the process exit before the request's abort is observed. - node:http: the canonical half-close + client-abort + server.close() scenario must drain (previously wedged forever on Windows). Also removes the now-stale expectations.txt comment block (#32488 removed the quarantine entry itself but left the comment). The H3-only sibling arm of stop_listening is still unguarded on main; testing it is blocked by an lsquic re-entrancy assertion on graceful stop() of an http3-only server with a request in flight, handed off separately.
…-guard test with a spawn timeout + signalCode assert
On debian-13 x64-asan the instrumented child's teardown pushed the 10 s spawn timeout (stdout was already 'CLOSED'/'SAW_ABORT' so the scenario under test passed; the SIGTERM came during exit). Bump both spawn timeouts to 30 s and shrink the half-close body to 64 KB (the mechanism is half-close-mid-upload, not the 10 MB size specifically).
60a6130 to
3360579
Compare
|
Closing as part of a cleanup of stale pull requests. This PR has had no new commits since 2026-07-17, it conflicts with main, and its last CI run failed. This is not a judgment on the fix itself. If the problem still reproduces on a current build, reopen this PR after a rebase or open a new one against main. |
Regression coverage follow-up for #34158 now that #32488 has merged the fix.
What #32488 fixed
stop_listening()'s TCP arm now holds the server'sKeepAlivewhilepending_requests > 0 || has_active_web_sockets(), andHandler::on_connection_closedre-evaluatesdeinit_if_we_can()so the deferred release completes for WebSocket connections. The Windows half-close quarantine entry was removed there.What this PR adds
A two-case subprocess regression test guarding that fix:
Bun.serve: gracefulstop()with an in-flight async handler must not let the process exit before the request's abort is observed (the POSIX-observable half).node:http: the canonical half-close + client-abort +server.close()scenario must drain (previously wedged forever on Windows).Plus: removes the now-stale expectations.txt comment block (#32488 removed the quarantine entry but left the descriptive comment above it).
Dropped from an earlier revision of this PR
The H3-only sibling arm of
stop_listening()(atmod.rs:1545, reached forBun.serve({tls, http3: true, http1: false})) still releases the ref unconditionally. Applying the same guard there is correct, but testing it is blocked by an lsquic re-entrancy assertion (lsquic_engine.c:3002: !((engine)->pub.enp_flags & ENPUB_PROC)) that fires on any gracefulstop()of an http3-only server with a request in flight. That crash and the H3 guard have been filed separately.[stamp-90s] gate passed · iteration 12 · 2 files touched
passes on PR (with fix)
diff hotspot
gate history · 9 passed · 1 rejected · iteration 12
evidence per changed file