Skip to content

reactor: report a failed write on the io handle - #266

Merged
EdmondDantes merged 1 commit into
mainfrom
write-failed-state-bit
Aug 23, 2026
Merged

reactor: report a failed write on the io handle#266
EdmondDantes merged 1 commit into
mainfrom
write-failed-state-bit

Conversation

@EdmondDantes

Copy link
Copy Markdown
Contributor

Needs true-async/php-src#27 (TrueAsync ABI 0.26.0). Guarded by #ifdef ZEND_ASYNC_IO_WRITE_FAILED, so this builds and behaves as before against an older php-src — which is what CI clones today (true-async-stable).

io_pipe_write_cb and io_pipe_writev_cb know the libuv status and build an exception from it, but on the fire-and-forget path the request is freed right there and its free_cb takes no status, so the error was released without anyone seeing it. The only report left was the read side, where a peer that shut its write half down is indistinguishable from one that is gone.

Both callbacks now set ZEND_ASYNC_IO_WRITE_FAILED on the handle before the free_cb runs. Nothing else changes: the awaited path already carries the status on the request, and UDP is untouched.

The consumer is true-async/server#249, where the read side stops standing in for the write side and a half-closed peer keeps its response.

A write submitted without an awaiter is freed in its completion, and the free_cb
it calls takes no status — so the libuv error was turned into an exception and
released without anyone seeing it. The only report left was the read side, where
a peer that shut its write half down is indistinguishable from one that is gone.
io_pipe_write_cb and io_pipe_writev_cb now set ZEND_ASYNC_IO_WRITE_FAILED on the
handle before the free_cb runs. Needs php-src at TrueAsync ABI 0.26.0.
@codecov

codecovBot commented Aug 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@EdmondDantes
EdmondDantes merged commit 3da69bc into mainAug 23, 2026
9 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@EdmondDantes