Repository navigation
fix(playback): start a rebuild's next FFmpeg attempt after the request that triggered it ends - #4110
Merged
Merged
Conversation
…t that triggered it ends A rebuilt transcode is shared by every request waiting on it. Its manifest wait already ran on a context detached from the request that triggered it, but each FFmpeg attempt was launched on that request's context. When the request ended and the first attempt exited early, the next attempt returned "context canceled" for an HEVC target, a capped VAAPI encode, or burned-in text subtitles, and every waiting request got that error. A rebuild now launches and waits on the same detached context. A fresh start is unchanged. Closes #4098 Co-Authored-By: Claude Fable 5.2 <[email protected]>
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:
|
Contributor
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This was referenced Nov 13, 2026
3 of 8 tasks
4 tasks done
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.
Problem
Closes #4098
Related issue: N/A
Validation tasks: none
Other clients: Apple N/A (server-side fix, no client change); Android N/A (server-side fix, no client change); Roku N/A (server-side fix, no client change)
Under Hardware acceleration set to Auto, a rebuilt transcode could fail with
context canceledfor every request waiting on it. It happened when the request that triggered the rebuild ended before the rebuild moved to its next fallback step, and the target was HEVC, a bitrate-capped VAAPI encode, or a stream with burned-in text subtitles. This change starts each attempt of a rebuild on a context that outlives that request, as the rebuild's wait already did.Approach
runTranscodeStartupwaited for each attempt's manifest on a context detached from the triggering request, but launched each attempt on that request's context.StartTranscodereturns a cancelled context's error for those recipes before it runs FFmpeg, so the second attempt failed and the error went to every request sharing the rebuild. A rebuild now launches and waits on the same detached context. A fresh start still uses the request's context for both.The first attempt is detached too. Once a rebuild is past admission it serves every waiting request, and detaching only the retries would leave the same failure for a request that ends just before the first start. Admission still runs on the request's context, so a cancelled request can leave the reconstruct queue as before.
The change covers the integrated manager and the transcode node, for native and Jellyfin playback. There is no API change.
Validation
StartTranscode: with the request cancelled during the first attempt, the second attempt returnedcontext canceledonmainfor HEVC on NVENC and for capped H.264 on VAAPI, and a session for H.264 on NVENC and uncapped VAAPI. With this change all four start.context canceledand passes here.gofmt,go mod tidy -diff,go vet,make lint-changed, andmake lint-router-recoverypass.make test-gopasses except two real-FFmpeg tests that fail the same way on the merge base on the test host (FFmpeg 6.1.1):TestCopyRemuxSubtitleRenditionRealFFmpegandTestRunStatsWithRealFFmpeg. Four packages needed a umask that keeps test temp directories private.Evidence
Evidence: https://evidence.siloserver.org/r/silo-server/issue-4098/
Risks
A rebuild for these recipes now does what an H.264 rebuild already does on
main: it runs to completion after its requester leaves. That extends three existing behaviors to them.ManifestStartupTimeout.mainthis happens for any rebuild whose start succeeds; this change adds HEVC, capped-VAAPI, and burned-in-subtitle rebuilds whose triggering request ended. It is filed as [bug] A transcode rebuild that finishes after a Jellyfin client stops playback leaves FFmpeg running #4112.Follow-ups: #4112 for the Jellyfin stop race. #4114 for the missing throttle. #4113 for the explicit-backend start path, which has the same defect as this one on
main.Checklist
AI Disclosure
main([bug] A rebuilt transcode on an explicit hardware backend fails with context canceled when the request that triggered it ends before FFmpeg starts #4113). The simplify pass changed nothing. A background adversarial review by gpt-6.1-sol of ea88573 found nothing: it re-ran the reported trigger against the realStartTranscode, confirmed the regression test fails on the base, and checked both merge orders with fix(playback): play Jellyfin streams and rebuilt transcodes when the GPU can't decode the source #4097. The branch has since mergedmainin (with fix(playback): play Jellyfin streams and rebuilt transcodes when the GPU can't decode the source #4097 and fix(playback): restart Intel transcodes on CPU decode after a filter graph failure #4105); the diff againstmainis unchanged, and the regression test still fails on the new merge base.🤖 Generated with Claude Code