Repository navigation
Playback: stop when the server ends the session - #1265
Merged
Merged
Conversation
An admin's stop (Tautulli, Tracearr, /status/sessions/terminate) closes the session at once, and PMS says so on the answer to the next timeline report: terminationCode and terminationText on the MediaContainer. The reporter threw that answer away, so the set went on reporting `playing` and playing its buffer. It stopped only when the next read was refused, 33 s later on a real set, and then showed the generic interruption with Try Again, which starts a fresh session the server accepts. The periodic report now reads the answer. A termination ends the reporter and raises a signal the pump turns into a failed Engine, with no recovery attempted. The read-out keeps the existing wording, quotes the server's reason the way a /decision refusal does, and offers only Back. No catalog key is added. The ended session also gets `stopped&continuing=1` at once, the report plxnative#1254 measured, so its row leaves the dashboard without waiting for the viewer to leave the read-out. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Filippo Scatigna <[email protected]>
There was a problem hiding this comment.
🟡 Changes recommended
Critical unresolved issues remain in server-stop ordering, terminal-signal preservation during reloads, and stale-reporter validation, allowing recovery or retired sessions to continue incorrectly.
3 open issues
What changed in this PR
This pull request makes playback stop promptly when PMS terminates the active session, preserves the server-provided reason, retires the dashboard session, and adds terminal failure handling and telemetry coverage.
Changes:
- Parse termination details from Plex timeline responses and stop further reporting.
- Propagate server stops through the playback pump as a terminal, Back-only failure.
- Send a final stopped status, update telemetry and privacy schemas, account for the new request, and add regression coverage.
| File | Summary |
|---|---|
rust-modules/telemetry/src/telemetry/classes.rs |
Adds the server_stopped failure telemetry class. |
rust-modules/telemetry/src/diag/schema.rs |
Extends the documented playback failure vocabulary. |
rust-modules/plex/src/plex/timeline.rs |
Parses timeline responses and detects server termination. |
rust-modules/plex/src/plex/params.rs |
Defines timeline answer and server-stop result types. |
rust-modules/plex/src/plex/client.rs |
Adds a JSON-preserving POST helper for timeline responses. |
rust-modules/media/src/route/decision.rs |
Handles termination answers, retires the PMS session row, and signals playback failure. |
rust-modules/media/src/route/decision_timeline_tests.rs |
Adds regression coverage for termination handling and final timeline reports. |
rust-modules/media/src/route/decision_test_support.rs |
Extends the recording PMS fixture with configurable response bodies. |
rust-modules/media/src/player/shared.rs |
Stores and resets server-stop state and reason. |
rust-modules/media/src/player/pump.rs |
Fails the active engine when a server-stop signal is observed. |
rust-modules/media/src/player/mod.rs |
Adds failure classification, reason propagation, and Back-only actions. |
PRIVACY.md |
Documents the new playback failure telemetry value. |
ci/plex-requests.ini |
Accounts for the new JSON timeline request site. |
This pull request requires changes.
Review effort: Lite
Three gaps Copilot found in the review of plxnative#1265: - The pump read the stop after the recovery landing and the outstanding-flight wait, so a stop during a failed open's recovery waited for the flight, and its landing could reload onto a new PMS session. The check now runs as soon as the Engine is borrowed. fail_current_engine ends the flight, and a landing already parked is discarded, which stops the encoder its worker registered. - reset_session_for_reload cleared the signal, so a stop that arrived while an adaptive reload was in flight was lost. Only a full reset clears it now. - A reporter can publish after its lease was invalidated. The stop now carries the logical session it was reported for, the playback generation an adaptive reload keeps, and applies only to that playback. Revalidating the Engine lease instead would drop a genuine stop in the reload window above, since every reload bumps the epoch. Each of the three new tests failed before its change. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Filippo Scatigna <[email protected]>
Signed-off-by: Gleb Linnik <[email protected]>
…off-frame Signed-off-by: Gleb Linnik <[email protected]>
Signed-off-by: Gleb Linnik <[email protected]>
Signed-off-by: Gleb Linnik <[email protected]>
GLinnik21
added a commit
that referenced
this pull request
Nov 7, 2026
#1265 added FailureKind::ServerStopped. The server ending the session is not the backend's refusal, so it maps to an unknown presentation failure and arms no backend fallback. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Collaborator
|
Thanks |
GLinnik21
added a commit
that referenced
this pull request
Nov 7, 2026
…nto lane/merge-1265 #1265 lands where integ keeps that code: the neutral parts (timeline reply, terminal-for-the-logical- playback, recovery cancel, read-out) stay in media; the physical Feed parts (deferred cleanup of an in-flight native Load, the off-frame release of the stopped engine) are play-feed's, reached through `FeedStop::stop_begin(terminal)`. A server stop is terminal for whichever backend plays: the backend-neutral `route_start::retire_if_server_stopped` releases a Feed engine or a URI attempt. #1268's paths take integ's side (integ is the superset); `backend_metrics.rs` gains main's `ServerStopped` arm, and the contract's `RuntimeFailure` gains the variant. Co-Authored-By: Claude Opus 5.5 <[email protected]>
GLinnik21
added a commit
that referenced
this pull request
Nov 7, 2026
GLinnik21
added a commit
that referenced
this pull request
Nov 7, 2026
…io, plx_base::clock, LoadVideo in platform, contract landing plan (#1272) Moves the lower-layer pieces the backend-neutral media code reads below `plx_media`, with no backend named: - The HTTP range transport moves from `media/src/curlio.rs` to `plx_net::range_io`, with its `curl_multi_*` `dynlib!` table (same symbols, candidates and one `Once`). `media::curlio` stays as the Plex credential facade over it, so its callers are unchanged. - `plx_base::clock` holds the monotonic clock `player::vclock_ms` now delegates to. - `LoadVideo` moves to `plx_platform::devcaps`; media's `engine::LoadVideo` re-uses it. - Plex `MediaPart.duration` and data `PlayingItem.duration_ms`. - The playback contract gains the Dolby Vision landing plan and withdrawal, `dv_landing_due`, `DvStandDown`, `stop_begin(terminal)` and `ServerStopped`, matching #1263 and #1265 on the integration branch; nothing on main calls them yet. `range_io` now asks the URL authorizer again at the start of a seek or reopen. That has no production effect today (curl sources are https, and a TLS origin is always allowed). With it, a start that returns early resets the attempt state, so a read after a refused seek fails instead of returning stale bytes and a clean end of stream. Related: #1064 Co-Authored-By: Claude Opus 5.5 <[email protected]>
nphil
added a commit
to nphil/Marquee
that referenced
this pull request
Nov 18, 2026
The timeline answer is now read for a server stop (an admin ending the stream from the dashboard). Playback ends at once, shows the server's own reason with Back as the only action, and the dashboard row is retired. A stop for another playback, or one that arrives after Back, changes nothing. Ported from upstream 96be5e2 (Playback: honor Plex server stops (plxnative#1265)).
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.

When an admin stops a stream (Tautulli, Tracearr,
POST /status/sessions/terminate), PMS closes the session at once and says so on the answer to the next timeline report:terminationCodeandterminationTexton the MediaContainer.Client::timelinethrew that answer away, so the set went on reportingplayingand playing its buffer.Measured on a real set (LG 32LQ63006LA, PlxNative 0.9.0, PMS 1.43.5.11079), direct-playing an episode:
prova; PMS terminates the sessionplayingthree more timesDenying access to direct play of part … due to terminated sessionSo the stop took 33 s and depends on how much is buffered. The set then showed the generic interruption, without the reason, with Try Again. Try Again started a fresh session that PMS accepted, so one key undid the stop.
What changes
Client::timeline_answerreads the answer to a periodic report.report_timelineuses it, and a termination ends the reporter, so no moreplayinggoes out.SHARED.server_stoppedwith the server's text and the playback it reported for: the logical session, which an adaptive reload keeps. The pump checks it ahead of the recovery landing and every failure branch, for that playback only, and fails the Engine with no recovery. An outstanding recovery flight ends, and its landing is discarded. The stop lands on the next tick, within the 10 s report interval. A reload keeps the signal; only a new playback clears it.FailureKind::ServerStopped(server_stopped) offers only Back. The read-out keeps the existing "stopped" wording and quotes the server's sentence indetail, the way a/decisionrefusal does, so no catalog key is added.stopped&continuing=1at once, the report Playback: a retired PMS session gets its stopped timeline (#1236) #1254 measured, so its row leaves the dashboard without waiting for the viewer to leave the read-out. On 0.9.0 the row stayed listed asplayingwith a frozen position. The finalstoppedstill goes out when the viewer leaves.server_stoppedjoins the closedplayback.failedvocabulary inclasses.rs,diag/schema.rsandPRIVACY.md, and the new request site is inci/plex-requests.ini.Verified
make checkis green on the branch, based onmainat 5b9ff4a: 35 suites, 24283 passed, 0 failed, 198 ignored, all 126 steps ok. The host runs were on WSL2 undersetarch -R, becauseci/test_check_collisions.pyfails at random there with "ThreadSanitizer: unexpected memory mapping", onmainas well.make check-nodefis clean.a_termination_on_the_answer_ends_the_reporter_and_keeps_the_server_s_reasonfails without the change toreport_timelineand passes with it.a_stop_from_the_server_ends_the_playback_with_its_reason_and_only_backruns the pump underhostsim: Error, Engine released, no recovery, the server's reason, only Back.a_stop_from_the_server_during_a_recovery_flight_ends_it_and_reloads_nothing: Error on the stop's frame, the rollback's flight ended, its replacement encoder stopped, nothing reloaded;a_reload_keeps_the_server_s_stop_and_the_next_session_drops_it;a_stop_the_server_sent_for_another_playback_leaves_this_one_playing.cargo check --target armv7-unknown-linux-gnueabionplx_plexandplx_telemetryis clean. The package was not built: there is no webOS NDK for linux-x86_64 here.Not verified
terminationCode,terminationText), and I haven't captured a real answer. An answer that doesn't parse leaves today's behaviour.🤖 Generated with Claude Code