Skip to content

fetch: abort the request when the response body reader is cancelled - #33231

Merged
Jarred-Sumner merged 10 commits into
mainfrom
farm/469333cb/fetch-reader-cancel-abort
Jul 4, 2026
Merged

fetch: abort the request when the response body reader is cancelled#33231
Jarred-Sumner merged 10 commits into
mainfrom
farm/469333cb/fetch-reader-cancel-abort

fetch: abort the request when the response body reader is cancelled

67b0af3
Select commit
Loading
Failed to load commit list.
Claude / Claude Code Review completed Jul 2, 2026 in 18m 1s

Code review found 1 important issue

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

Details

Severity Count
🔴 Important 1
🟡 Nit 0
🟣 Pre-existing 0
Severity File:Line Issue
🔴 Important src/runtime/webcore/fetch/FetchTasklet.rs:1628-1630 Unsynchronized read of result.has_more in on_stream_cancelled_callback

Annotations

Check failure on line 1630 in src/runtime/webcore/fetch/FetchTasklet.rs

See this annotation in the file changed.

@claude claude / Claude Code Review

Unsynchronized read of result.has_more in on_stream_cancelled_callback

This reads `this.result.has_more` on the JS thread without holding `this.mutex`, but the HTTP thread's `callback()` wholesale-replaces `task_ref.result` under that mutex (line 2356) — every other JS-thread reader of `self.result` (e.g. `on_progress_update` at line 809, the sibling stream-start callback at line 1578) locks first. Since `reader.cancel()` fires precisely while the body is still arriving, the HTTP thread can be mid-move of `result`, so this is a data race; a stale `has_more == false