fetch: abort the request when the response body reader is cancelled - #33231
Merged
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
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
Loading