Repository navigation
fix(http1): park the awaited sender until the coalesce tail is empty (#211) - #212
Merged
Merged
Conversation
Contributor
CoverageTotal lines: 82.72% → 82.49% (-0.23 pp)
|
EdmondDantes
force-pushed
the
211-awaited-sender-waits-for-tail
branch
from
August 22, 2026 07:14
be530a0 to
aa7638e
Compare
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 free
to 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.
Closes #211.
A streamed HTTP/1 response overtook a buffered one still sitting in the coalesce
tail. #209 fixed the two fire-and-forget senders; the awaited ones —
http_connection_send_rawandhttp_connection_send_strv_awaited— submitted atconn->iojust the same. It takes two buffered responses ahead of the stream toshow it: one in flight, one copied into the tail, and only the tail can be
overtaken, which is why #209's three-request reproduction missed it.
The awaited senders now park until no batched write is outstanding and the tail is
empty, on a connection-lifetime event fired from every site that clears
out_in_flight, a failed submit included.out_signal_draincould not serve: itfires at the low-water mark and mid-chain, while the flag is still set.
Shape 2 from the issue — append to the tail and return — was refused because it
takes HTTP/1's backpressure with it:
h1_stream_append_chunkreadsstream_deadfrom the send's return value, the write deadline has nothing to bracket, and every
chunk pays back the copy #184 removed. The decision is recorded in the issue.
TLS needs no branch:
tls_pushtakes those bytes beforesend_rawis reached andthe batched senders are plaintext-only, so the wait condition is unreachable there.
A
ZEND_ASSERTsays so at the wait.Cost: an awaited send that lands behind batched bytes now pays a scheduler turn,
and
setWriteTimeoutbounds the queue wait together with the write.Evidence:
h1/052— four pipelined requests,/1and/2buffered,/3and/4streamed.
S1,W3a,S2,W3b,W4a,W4bagainstmain,S1,S2,W3a,W3b,W4a,W4bhere.Full suite 461 tests, 436 passed, 0 failed, 24 skipped on absent tool gates, 1 warn
(
core/047, the pre-existing XFAIL that passes);ctest16 of 16.