Uh oh!
There was an error while loading. Please reload this page.
async: report a failed write on the io handle (ABI 0.26.0) - #27
Merged
Conversation
A write submitted without an awaiter gets no status of its own: its completion is a free_cb that takes the handle and the user pointer, nothing else. The consumer was left to infer the failure from the read side, where a peer that merely shut its write half down looks exactly like one that is gone. ZEND_ASYNC_IO_WRITE_FAILED is that report. The reactor sets it on the handle when a write completes with an error and never clears it, so a consumer can tell "this connection can no longer be written to" from "this peer has stopped sending". It says nothing about the read side.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A write submitted without an awaiter gets no status of its own: its completion is a
free_cbtaking the handle and the user pointer, nothing else. The consumer was left to infer the failure from the read side — and there a peer that merely shut its write half down looks exactly like one that is gone.ZEND_ASYNC_IO_WRITE_FAILED(bit 7, the first free one) is that report. The reactor sets it on the handle when a write completes with an error and never clears it. It says nothing about the read side, which is the point: a half-closed peer keeps reading.Why the read side cannot stand in for it: the kernel hands
so_errorto whichever syscall asks first, and with a saturated outbound queue that is the write. Measured on bare sockets after an RST —write -> ECONNRESET,write -> EPIPE,read -> b'': the read behind the failing write returns a clean EOF and reports nothing.Consumers: php-async sets the flag (true-async/php-async, branch
write-failed-state-bit), and true-async/server reads it to keep a half-closed peer's response alive while still answering 499 to one that is gone (true-async/server#249). Both are guarded, so neither needs this to land first in order to build.ABI 0.25.0 → 0.26.0: additive, no signature or layout change.