deno
dcc04bbd - fix(ext/node): defer uv_write callbacks to prevent re-entrancy panic (#32919)

Commit
224 days ago
fix(ext/node): defer uv_write callbacks to prevent re-entrancy panic (#32919) ## Summary - `uv_write` in the uv compat layer was firing write callbacks synchronously when `try_write` succeeded fully or failed. This caused a `RefCell` double-borrow panic ("RefCell already borrowed") when the caller (e.g. `StreamWrap.write_buffer`) held an `OpState` borrow during the `uv_write` call, and the synchronous callback re-entered JS which called another op borrowing `OpState`. - Changed both TCP and TTY `uv_write` implementations to always queue completed writes with a pre-determined status, deferring callbacks to `poll_tcp_handle`/`poll_tty_handle` in the event loop. This matches real libuv behavior where `uv_write` never fires callbacks synchronously. - Added a `status` field to `WritePending` to support pre-completed entries that skip I/O in the drain loop. Closes #32891 Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Author
Parents
Loading