Skip to content

s3: S3File.writer().end(error) aborts the upload instead of committing - #33681

Open
robobun wants to merge 9 commits into
mainfrom
farm/b1f3dbf2/s3-writer-end-error-aborts
Open

s3: S3File.writer().end(error) aborts the upload instead of committing#33681
robobun wants to merge 9 commits into
mainfrom
farm/b1f3dbf2/s3-writer-end-error-aborts

s3: S3File.writer().end(error) aborts the upload instead of committing

82dda2c
Select commit
Loading
Failed to load commit list.
Claude / Claude Code Review completed Jul 7, 2026 in 30m 48s

Code review found 1 important issue

Found 4 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/streams.rs:2445-2453 fail_from_js: aliasing UB — re-enters &mut NetworkSink via wrapper_callback

Annotations

Check failure on line 2453 in src/runtime/webcore/streams.rs

See this annotation in the file changed.

@claude claude / Claude Code Review

fail_from_js: aliasing UB — re-enters &mut NetworkSink via wrapper_callback

`fail_from_js` holds `&mut self` (LLVM `noalias`, from `js_end` → `get_this`) across `self.task_mut().unwrap().fail(...)`, but `MultiPartUpload::fail()` synchronously invokes `wrapper_callback_thunk` with `callback_context = *mut NetworkSink`, which forms a **second** `&mut NetworkSink` via `bun_ptr::callback_ctx` and writes `self.task = None` through it (`finalize()` → `detach_writable()`). That violates `callback_ctx`'s documented safety contract ("No other `&mut T` … may be live") and is Stac