Repository navigation
fix(playback): move a transcode off a dead node instead of failing every segment - #1956
Conversation
…ery segment When the API relays a remote HLS transcode and its transcode node dies, every later manifest and segment request failed until the client replanned, and a failure_recovery replan could not leave the node because the attempt key ignores the executor. The relay now treats a refused or failed connection (or any transport failure against a node the pool already lists as unhealthy or no longer pools) as a dead executor. It marks the node unhealthy in the pool at once, then rebuilds the same transport from the recipe the restart paths use (the client's stream token, or the stored node recipe for tokenless sessions) on another executor chosen by the routing policy with API egress: another pooled node through the ordinary start contract, or this process through ReconstructTranscode. The session id, transport id, and client URLs stay the same, the new executor resumes where a reconstruction would, and the route moves with a compare-and-swap so a concurrent replan wins. Moves are single-flighted per session and remote starts take a reconstruct slot. HTTP errors from a live node are still relayed unchanged, proxy-origin sessions keep the replan-and-remint rule, and Jellyfin compatibility relays are not covered.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: 🟡 Moderate · up to
|
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
|
Examined 6 accessible cases/criteria; most severe classification: major change.
The PR must explain why the previously exercised reconnect scope changes; #1252 C5 needs re-validation after merge for worker loss. The Not run cases need their first validation on a post-merge build. I could not read Silo-Server/silo-apple#22, #23, #337, #338 or Silo-Server/silo-android#7, #8, #347, #348 in this run, so I have not classified their cases or results. Issue #199 is titled Movies — Web; “Resilience” identifies its acceptance criterion. Suggested replacement for the current
The Oct 2 comment on #1252 records the rehearsal although that issue's formal Results table remains Automated check: Macroscope check run agent (gpt-6-luna). No validation was performed. Posted via Macroscope — v1 validation impact |
|
The failing |
Quick104
left a comment
There was a problem hiding this comment.
This review found 10 problems in the dead-node failover, 5 confirmed against the code and 5 plausible but not reproduced. The most serious:
- Duplicate moves: the moved route lives only in one API process, so a session rebuilt from its stream token after an API restart, or on another replica, moves a second time.
- Recipe mismatch: the move skips the node eligibility filter, so a moved transcode can land on a node with a different encode recipe.
- Trigger too broad: any single failed dial triggers a move, including a node restart or local fd exhaustion on the API.
- Wrong status: tone-map errors reach the client as a retryable 502 instead of the documented 422.
Two findings, on duplicate moves and the dial threshold, are marked "needs your call" because the repair involves a design choice. Not posted here: duplication between the moved start request and the fresh start path. It matches field for field today, so it is cleanup only.
Validation: no case recorded as passed on the v1.0 board is reached by this diff. The tasks on the Validation tasks: line have no recorded result yet.
AI disclosure: written by claude-opus-5-5 in Claude Code via T3 Code (/silo code-review). The findings were checked against the code at 19fa48c, but none were reproduced on a running server.
…ith replans A move off a dead node now applies the capability filter of a fresh start from the session's current v3 plan, re-checks the chosen node, and checks local capabilities before rebuilding here. It commits under the session lifecycle lock, and replans read the route they replace under that lock, so neither orphans the other's transport. A source-level tone-map refusal ends the move with the documented 422, an expired move stops at once, an unreachable candidate is marked unhealthy, and local socket exhaustion no longer counts as a dead node. The stored node recipe survives a candidate's rollback stop and is written after the old node's retire stop, a lost compare-and-swap releases its reservation, and a failed retire is logged as a warning. The docs state that moves are per API process.
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
… recipe alone after a move A move that loses its session releases only a reservation that still charges its own node, so a concurrent replan's reservation under the same session id stands. The stored recipe a move writes late, after the old node's retire or a candidate's rollback, is written under the session lifecycle lock and only while the session still runs that route.
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
|
Silo's pull request guidance changed today (#2016). A PR that changes what a user sees now needs before-and-after evidence in its Evidence section, and a PR with no visible change says Missing here: A before-and-after recording of a client playing through a transcode node being killed: playback stops on main and keeps going with this change. The rules are in Show visible changes, and the PR template shows the Evidence section layout. I've converted this PR to draft for now. Mark it ready for review once the Evidence section is filled in. Generated by Claude Code |
|
Removed the blanket claim that none of the validation tasks has recorded evidence. The description now distinguishes the #1252 C5 reconnect rehearsal from formal RC/device results and asks for worker-loss re-validation after merge. The existing before/after recording covers playback after the worker is killed. |
Problem
Related issue: N/A
Validation tasks: changes #1177 C3, #1178 C2, #1250 C5, #1252 C5, #199 Resilience, Silo-Server/silo-apple#22 Resilience, Silo-Server/silo-apple#23 Resilience, Silo-Server/silo-apple#337 C5, Silo-Server/silo-apple#338 C5, Silo-Server/silo-android#7 Resilience, Silo-Server/silo-android#8 Resilience, Silo-Server/silo-android#347 C5, Silo-Server/silo-android#348 C5 (#1252 C5 has a recorded rehearsal that needs re-validation for worker loss; the Not run cases need initial validation after merge)
When a remote transcode node dies mid-stream, playback on it never recovers. The API keeps relaying the session's segment requests to the dead node and answers every one with
500 internal_error, even after the health sweep marks the node unhealthy. A client that follows the protocol and sends afailure_recoveryreplan getsadaptation_exhaustedwithretryable: false, because the attempt key covers the recipe but not the node, so the only recipe counts as already tried. Only a fresh playback start works. Silo is meant to treat a node dying mid-stream as a normal event; today it ends playback.When the API relays a native v2 HLS transcode and can't reach the node, it now marks the node unreachable (through the shared mark from #2342, now on main) and rebuilds the same transcode on another executor from the session's recipe: another pooled node, or this server. The client keeps the same URLs and timeline, and nothing changes in the protocol or in clients.
Approach
docs/architecture/restart-resilient-playback.mdnow states the boundary. Sessions whose media URLs point at a proxy node keep the documented rule that failover needs a replan and a new token, since the origin the client sees would change.Validation
worker_only;go testfor nodepool, playback and handler packages (new tests also under-race),go vet,gofmt,make lint-changed,make verify-local-paths: pass.make test-gowas not run locally.Evidence
Before
before-node-killed-playback.mp4
After
after-node-killed-playback.mp4
Both recordings show the web player running a native v2 HLS transcode on a remote transcode node. At 0:06 in each clip, when the player reaches 5 s, the node process is killed with SIGKILL. Before, the player stops at 0:08 of the video. Every segment and manifest request after the kill gets
500, and the player stays on a spinner. After, playback continues without a pause, because the next segment request moves the transcode to the API server's own ffmpeg.Segment requests around the kill (clip time, status, path)
Before
After
Server log, after:
moved a transcode off an unreachable node ... executor=api requested_segment=21.Surface and build: web player, native v2 HLS transcode relayed through the API from a remote transcode node; before 7d4b831 (main), after 893aa36 (PR head). One API server in integrated mode and one transcode node on the same machine, with default routing settings. The test library has one synthetic MPEG-4 Part 2 clip, which the browser cannot direct play.
Risks
nodepoolcode, which survives pool reloads, schedules rechecks, and tells the other API replicas. This PR no longer carries its own copy.worker_onlywith one node), the relay still answers an error, and the client must start again.failure_recoverystill ignores which node failed, so a client that replans before the move happens can still getadaptation_exhausted.Checklist
AI Disclosure
Note
Move transcodes off unreachable nodes instead of failing every segment
maxRehomeAttemptsV3(8) executors. Tokenless sessions rehome from the stored recipe.TranscodeRehomeTimeout), and route commits are compare-and-swap style: stale executor moves are no-ops (transcode_manager.go, session.go).relayToTranscodeNode(renamed fromproxyToTranscodeNode) now returns an error only for unreachable nodes, and local-transport rollback targets the live route instead of the session snapshot (playback_v3.go, playback_proxy_test.go).Macroscope summarized 893aa36.