Skip to content

fetch: cap the GC-triggered drain of an abandoned Response body - #35819

Closed
robobun wants to merge 7 commits into
mainfrom
farm/86246add/fetch-abandoned-body-drain-cap
Closed

robobun wants to merge 7 commits into
mainfrom
farm/86246add/fetch-abandoned-body-drain-cap

trim doc comments

9d481e4
Select commit
Loading
Failed to load commit list.
Claude / Claude Code Review completed Jul 25, 2026 in 47m 2s

Code review found 2 potential issues

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

Details

Severity Count
🔴 Important 0
🟡 Nit 2
🟣 Pre-existing 0
Severity File:Line Issue
🟡 Nit test/js/web/fetch/fetch-response-abandoned-drain.test.ts:96-99 64 KiB test likely does not exercise the finalizer drain arm it claims to guard
🟡 Nit src/http/lib.rs:4051-4054 5s Ignore-drain deadline is a no-op when flags.disable_timeout is set

Annotations

Check warning on line 99 in test/js/web/fetch/fetch-response-abandoned-drain.test.ts

See this annotation in the file changed.

@claude claude / Claude Code Review

64 KiB test likely does not exercise the finalizer drain arm it claims to guard

The 64 KiB test almost certainly does not exercise `abandon_response_body_from_finalizer()`: on loopback the server writes headers + 4×16 KiB synchronously, the HTTP thread sees the complete body in one `on_data()`, `to_body_value()` returns `InternalBlob` (not `Locked`), and `on_response_finalize` early-returns at :2546 — the connection is pooled via normal completion, not the drain arm. Your own before/after table shows the 64 KiB row is identical on `main` and this branch, which is what you'd

Check warning on line 4054 in src/http/lib.rs

See this annotation in the file changed.

@claude claude / Claude Code Review

5s Ignore-drain deadline is a no-op when flags.disable_timeout is set

The 5 s "absolute drain deadline" is a no-op for `fetch(url, { timeout: false })`: `resume_receive` arms `socket.set_timeout(5)` directly, but `on_timeout` at lib.rs:2105 early-returns on `self.flags.disable_timeout`, and since `on_data` no longer re-arms in Ignore mode the socket is left with no timer at all. Not a regression (pre-PR `resume_receive` → `self.set_timeout()` → `set_timeout(0)` was equally indefinite), but the comment's invariant doesn't hold for this case — consider having `on_ti