Repository navigation
fix(hls): stream segment bodies on the persistent HTTP/1.1 ingest, no 45 s exchange ceiling (#732) - #816
Merged
Conversation
… 45 s exchange ceiling (#732) Under heldSourceConnection the HEVC-in-MPEG-TS VOD ingest downloaded every segment whole before the demuxer saw a byte, its carriage probe downloaded segment 0 whole, and one 45 s deadline covered head and body together. On a slow origin a large segment could not finish inside it, and the expiry surfaced as the socket's own POSIX timeout (Code=60), naming neither cause. - PersistentHTTP1Transport.open returns the response head and a Body read piece by piece; get() is open plus collect. - The 45 s ceiling covers only the wait for a response head. A body ends on its size limit or on 30 s without a byte (typed .stalled with received/expected bytes and elapsed time). - One request per origin at a time: checkOut claims the origin and the next request waits for the connection to be pooled or closed, so a seek never opens a second connection beside a response still in flight. - An abandoned body with at most 2 MB left drains for up to 3 s and keeps its socket; a larger remainder closes it. - The probe reads the head and hands the open response to the producer. - With the FIFO full the current segment is read to its end, so a pause idles the connection between requests, not mid-body. - The h2 path's 45 s resource timeout is lifted the same way. Measured on a loopback keep-alive origin at 200 KB/s with 11.6 MB segments: before, the probe died at 45.1 s with Code=60 and the session left the ingest; after, the ingest held and played. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WJcXkGQrMiBPixVEFTSBJS
- A probe response the producer's run does not open with (a seek onto another or an encrypted first segment) is abandoned before any request. It held the origin's claim unread, so the next request waited forever. - A request cancelled while it waited for the origin does not take the connection; its cancellation handler would close the drained socket. - A seek drains an abandoned body only when the rest arrives within the drain deadline at the rate seen so far; a slow remainder closes at once instead of holding the next request 3 s and closing anyway. - next() checks cancellation before marking a read in flight, so abandon() never waits on a read that does not happen. - A refused or redirecting body is drained for at most 45 s. - No extra copy of each chunk into the pending buffer. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WJcXkGQrMiBPixVEFTSBJS
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.
Follow-up to #732 after the paired device runs: the held HTTP/1.1 transport was fine on protocol and reuse, but its delivery semantics failed on slow origins.
What changes
PersistentHTTP1Transport.openreturns after the response head, and the body reaches the ingest FIFO as it arrives.NSPOSIXErrorDomain Code=60; a stall now readsbody stalled, no bytes for 30 s after <received>/<expected> bytes in <elapsed> s.Measured
aetherctl play --held-connectionagainst a loopback keep-alive origin with a shared rate limit, 3 x 60 s HEVC-in-TS segments of about 11.6 MB:bb351047)Code=60after 8.2 of 11.6 MB, session leaves the ingestTests
Issue732PersistentHTTP1Testsgoes from 10 to 18 tests: streaming before the segment ends, the probe leaving segment 0 open, a drained seek on one connection with at most one response in flight, close on a large or slow remainder, the drain deadline, a stall error carrying its progress, a steady slow body that outlives the read timeout, a full FIFO letting the current segment finish while the next request waits, and a seek onto an encrypted first segment (hangs without the fix, verified). Fullswift test: XCTest 778 and swift-testing 4614, exit 0.Not in scope
🤖 Generated with Claude Code
https://claude.ai/code/session_01WJcXkGQrMiBPixVEFTSBJS