Repository navigation
Sequential media GETs reuse the HTTP/1.1 demux socket - #89
Conversation
@GLinnik21 Agree. The live-fd reuse path already captures interrupted across reset_fields. The redial-after-Transport path does not, drain can stall on split chunked trailers, and tests/serve_fixtures.py still answers Connection: close, so the pipeline never reuses. Will fix those three and push. |
6a0a30c to
7823a55
Compare
Signed-off-by: Marco Rojas <[email protected]>
…mprove connection reuse logic, and add tests for keep-alive behavior in media GET requests. Signed-off-by: Marco Rojas <[email protected]>
8da27e4 to
e447ff8
Compare
Signed-off-by: Marco Rojas <[email protected]>
GLinnik21
left a comment
There was a problem hiding this comment.
The retry race is fixed, but the broader entry race is still here.
GLinnik21
left a comment
There was a problem hiding this comment.
The real TV run exposed one fixture-server regression from enabling keep-alive.
|
For device verification, you can ask an agent to run the universal synthetic player tier ( |
Thanks! Yeah I've just doing some manual testing along with running some partial tests. Long term we can probably looks at something like https://github.com/iwalton3/stdjflib or our plex-variation to run a full regression and programmatically generate a PMS test library. |
As you can see, I'm doing a huge refactoring of the UI architecture. Turns out GPT Astra generates such mocks on the fly 😅 to check behaviour |
…ance for Linux, and add tests for in . Update struct in to manage trailer line content and improve connection handling logic. Signed-off-by: Marco Rojas <[email protected]>
cfc99a9 to
a1b0752
Compare
There was a problem hiding this comment.
Update: I ran the same two cases against current main (6073ae00cfe17e3cea58d19e50e734f4fe9cc2c5) on the same TV, network, and fixture pack. Both fail there too, with essentially the same numbers:
pipe_replay_after_eos: again 0replay:lines and one body instead of two.pipe_abr_down_collapse: again onlypos_climbfails — 37s instead of the required 45s (the PR run reached 36s).
So these failures were not introduced by #89 and should not block it. The PR run itself finished 42/44; all keep-alive, HLS/ABR wire, and Range-reuse checks passed. Sorry for the noise — the baseline control clears the PR.
Both device failures reproduce on main under the same conditions, so they were not introduced by this PR.
Merges #92 (trailer playback from detail), #89 (sequential media GETs reuse the HTTP/1.1 demux socket), #94 (Windows WSLg/Linux simulator support), the landing-page site/ tree and other unrelated origin/main work into this branch's own commit (13316a8, "fix: scrub bare host= key/value hostnames from logs"), resolving each conflicted file by preserving both sides' intent: - rust-modules/src/player/ffi.rs, mod.rs, pump.rs, threads.rs, webos.rs, src/starfish.c, rust-modules/src/app/playback.rs: kept both branches' independent additions (resolved in earlier sessions on this branch). - rust-modules/src/player/shared.rs: kept both sides' distinct `LoadCall` enum members; git's auto-merge had silently produced a duplicate enum definition with no conflict markers, caught only by compiling. - rust-modules/src/player/engine.rs: removed a duplicate `load_in_flight_tests` module that auto-merge combined from both sides without markers. - rust-modules/src/plex/session.rs: wired `trailer_autoplay` (our side) into `CanonicalSessionPreferences`, `split_public()` and `join_canonical()` (origin/main's refactor of the same struct), which the auto-merge had left half-connected. - rust-modules/src/screens/registry.rs: recombined the `SCREEN_SHAPES_PIN` changelog (already merged cleanly as text) and bumped the pin constant to the merged tree's real hash (0xb462_145d_9477_05de -> 0x0e66_311c_e4f1_0769), documenting the bump as the union of independent changes rather than one feature. Two more fixes were required for the merged tree to pass verification at all, both confirmed to be pre-existing defects already present on origin/main's own fetched tip (227d981) rather than anything this merge produced: - ci/check-deps.sh: restored the missing closing brace on `strip_strings_and_comments()` (a bash syntax error on origin/main's tip that broke `make check`). - ci/allow/sibling-migration.txt: replaced literal, unresolved stash-conflict markers baked into origin/main's own committed content with this branch's already-clean, closed-out version (count 0, matching a dangling repair commit b58db338 that fixed the same file identically but was never merged into origin/main). One further fallout fix, found only by the fourth verification command and unrelated to origin/main (the file does not exist there at all): rust-modules/src/webos/jail_repair.rs's `expect(dead_code)` condition on `Failure::Timeout` incorrectly required `devtriggers` to be off; hostsim's `call_hbc` stub never constructs that variant outside tests regardless of `devtriggers`, so `cargo check --features hostsim` (as opposed to `cargo test`, which compiles the test module that uses it) failed. Narrowed the condition to `hostsim` + `not test`. Verification, all green: - make check: full host suite + make lint + ci/check-deps.sh + all package/dependency gates pass (exit 0). - CARGO_INCREMENTAL=0 cargo +nightly check --no-default-features: passes. - cargo +nightly check --features hostsim: passes (after the jail_repair.rs fix above). - make (ARM cross-build, FLAVOR=debug): passes, produces pkg/plxnative and pkg/plxnative-storage. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01W3rkPgGB7xpjGgcPbfakaF
…ive fetch (#209) On the TV, `pipe_abr_down_collapse` froze the picture for 84.5 s when the link collapsed from 40 Mbps to 500 kbps on rung 20000. The same-encoder lookahead from #89 (`hls_prefetch_same_encoder`) fetched segment 11 with no stall guard. It also swallowed any error into requeue + Ok(None), while the ordinary fetch of the same cursor always armed the guard. `hls_demux_segment` now takes one required `SegmentAcquisition` instead of an optional (deadline, guard) pair. The policy is sealed in `ff_acquisition.rs`: - Cursor fetches are built only by `for_cursor(Option<&abr::Controller>)`, which samples the live reserve, floor and hold itself. - Candidate transfers use `candidate(deadline)`, unchanged. - All four callers are migrated. Both fetch paths route `StallAbort` through one reducer, `hls_stall_abort_outcome`: requeue once, feed nothing, sample `.abandoned()`. Regression tests drive the lookahead's real control flow. They went red under both reverts: an unguarded lookahead, and a swallowed abort. On the TV, all 23 ABR cases pass. `down_collapse` logs `stall abort seq=11 … cause=terminal_reserve`, the freeze drops from 84.5 s to 5.8 s, and playback reaches 111 s. `make check` passes: 4199/4250/101, with 0 failed. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Media socket is closing after every sequential GET. Each HLS segment and each Original range paid a new TCP handshake for a server that already speaks HTTP/1.1 keep-alive. That shows up as a stall, not as tidy cleanup.
What this PR changes
Media requests now leave
Connectionoff so PMS can keep the fd. The next GET to the same peer reuses it once the previous body is fully read. An unread body, leftover buffer bytes, HTTP/1.0, or an explicitConnection: closestill opens a new socket.If the peer idles out or half closes, we redial once instead of failing the GET. A shutdown of a live keep-alive fd is teardown of that open. We do not dial a replacement the shutdown cannot reach.
Chunked responses consume trailers before reuse, so leftover bytes are not mistaken for the next status line. Incomplete trailers close the socket.
crate::httpis unchanged: it still sendsConnection: closeand still closes a one shot stream. HTTPS media reuses the libcurl multi across playlist and segment URLs. A Range seek still closes first, so tests can still tell a seek from a reused GET by counting accepts.Keep-alive only helps if the socket stays readable. Original parks
aq_pushon the AVIO thread, and a full AU queue used to let the TCP window collapse (or let PMS FIN us). While parked we now drain available bytes into the bounce buffer. That is why reuse survives a backlog.Docs that still said media used
Connection: closeare updated. Main-thread control-plane freezes are the same as before.Verification
Host tests in
stream.rs,aq.rs,http.rs,curlio.rs, andff.rscover:two drained HTTP/1.1 and chunked GETs share one accept
Connection: close, an unread body, HTTP/1.0 keep-alive, and incomplete trailers do not reusenamed chunked trailers reuse; poisoned leftovers do not
media sequential GETs omit
Connection: close; control-plane plaintext still sends itshutdown of a live keep-alive fd does not dial a replacement
idle peer close redials the next GET; teardown after that close does not
drain returns immediately when the body is done or the peer stalls mid-chunk
mid-body EOF is a transport error on both read and drain
aq_push_with_drainruns while the consumer holds the queue fullcurl sequential GETs reuse the multi for a second GET
make checkCARGO_INCREMENTAL=0 cargo +nightly check --manifest-path rust-modules/Cargo.toml --lib --no-default-featuresReuse and drain are host-visible. Whether Original holds a live socket across a real AU backlog still needs a TV play.