You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(transcodenode): keep a rebuild's software retry that is still starting - #4504
Depends on: none. Builds on #4251, which has merged. Merge order: none.
Problem
Closes#4263
Related issue: N/A
Validation tasks: none
Other clients: N/A (no client-visible change)
On a transcode node, when a rebuilt transcode's hardware encode died at startup, the node started a software retry and waited 30 seconds for its first manifest. If the retry was still running at that point, the node closed it, removed the session's output directory and failed the rebuild, even though FFmpeg might have written output a few seconds later. The next request then started the rebuild again from the hardware attempt. This affects nodes whose backend has a software retry: VideoToolbox, or QSV/VAAPI with no render device.
With this change a retry that is still running at the deadline is kept, like a slow first attempt.
Approach
The node's rebuild had its own copy of the start, wait and software-retry logic, and #4263 came from that copy drifting from the shared one. startReconstructProcess now calls playback.StartReconstructTranscode with TranscodeStartupRetryAccelChange, the policy handleStart already uses for fresh starts on the node. That path waits for a manifest the current process wrote (#4099), keeps any attempt still running at its deadline, retry included, and stops a failed attempt with CloseProcess before the retry. A retry that exited without output is closed and fails as before.
A rebuild on these backends also gets the CPU-decode retry when the GPU decoder rejects the source, as a fresh start does.
Tests set a new unexported Server.reconstructStartupWait, passed as the startup timeout (zero keeps the 30 s default), so the new test takes 3 s.
Validation
Not reproduced on a deployment or on real VideoToolbox or QSV/VAAPI hardware.
One new test calls spawnReconstruct with a fake FFmpeg: the VideoToolbox attempt exits, and the software retry runs without writing a manifest. It fails on main with manifest not ready after 30s: ffmpeg still running and passes on this head. It also fails when the shared startup path is changed to drop a slow retry.
go test for internal/transcodenode and internal/playback: pass.
make lint-changed against main: 0 issues.
Evidence
Nothing visible changes. The page has the test output before and after.
A retry that keeps running but never writes a manifest now stays registered instead of failing at once, as a slow first attempt already does. It is not rebuilt while it stays registered, and the idle reaper ends it once requests for it stop.
No API, config or compatibility change.
Checklist
I read and can explain the complete diff.
This pull request addresses one concern.
Each test this pull request adds meets "Decide what to test" in CONTRIBUTING.md.
The Evidence section shows every change a user can see, or how I checked a change nobody sees.
AI Disclosure
Harness: Claude Code in the Claude desktop app; maintainer review in Claude Code (T3 Code)
Tool(s): Claude Code; Codex and Antigravity (review)
Model(s): claude-opus-5-5; gpt-6.2-sol and gemini-4-neon (review)
Involvement: Fully AI-generated, not yet human verified. The review commit routes the rebuild through the shared startup path and shortens the test.
Adversarial review: claude-opus-5-5, gpt-6.2-sol and gemini-4-neon reviewed f4a250c8e2; their findings are handled in eeb95fbfe0, which a second round reviewed with no new defects. 6e4d6fc4b6 only lengthens the test's wait.
Fix transcodenode.Server.startReconstructProcess to keep software retries still starting
Reconstruction startup now delegates to the playback reconstruction starter instead of the local software-retry and readiness-check sequence in server.go
Passes the automatic transcode pipeline, the configured startup wait, and the legacy accel-change retry policy. An attempt still running at its startup deadline is kept rather than duplicated or discarded
Adds a startup-wait override field on transcodenode.Server; zero keeps the default timeout
Behavioral Change: retry handling for reconstruction now lives in the playback starter, so the removed local retry branch in startReconstructProcess no longer runs
No actionable comments were generated in the recent review.
Walkthrough
Reconstructed transcodes now use playback.StartReconstructTranscode for startup and retry handling. A new test verifies that reconstruction returns and registers a software retry that is still running after the startup wait ends.
Changes: Reconstructed software retry
Layer / File(s)
Summary
Keep running retries after timeout internal/transcodenode/server.go, internal/transcodenode/server_test.go
startReconstructProcess delegates startup and retry handling to playback.StartReconstructTranscode and accepts a configurable startup wait. The test checks that a still-running software retry is returned and registered, and that both HLS attempts occur.
Rebuilds on transcode nodes now keep a software retry that is still starting instead of failing the rebuild. If that retry later exits without producing a manifest, it can keep being served as a live session until it is cleaned up, so manifest requests may fail or return stale output. The author has acknowledged this and plans a follow-up. The risk is narrow, so this is mergeable with that follow-up tracked.
Security architecture risk: Low · up to eeb95
Slow software retries can finish without forcing playback to rebuild again. In a narrower decoder-rejection case, the new retry order can delay software encoding and temporarily tie up capacity needed by other rebuilds on the same node. The change does not widen who can start a rebuild or which media it can access.
Retained concerns
Low · reliability · observed: Decoder rejection on an eligible explicit backend can now add a mixed CPU-decode and hardware-encode attempt before the full software fallback. If the mixed attempt fails before readiness, the rebuild can use three attempts instead of two, holding its node-wide rebuild slot and per-session lifecycle lock for an additional attempt and reducing capacity for unrelated rebuilds on that node.
Security review details
Security Blast Radius
inferred — The supported capacity impact is local to the node handling an admitted rebuild: the extra attempt occupies the same slot used by other rebuilds on that node. It does not create another writer for the session or another source-access path.
Trust Boundaries and Controls
observed — Reconstruction still validates the session ID, opens media using the resolved source grant, checks the stop fence under the lifecycle lock, and registers the session with the identity from the same resolution. Request cancellation is detached only after rebuild admission.
Resilience and Maintainability Implications
observed — A retry retained at the deadline enters the normal registered-session lifecycle. Missing segments remain subject to the existing recovery decision, and idle cleanup rechecks session identity and access time under the lifecycle lock before closing it.
Pre-merge checks: 2 · 2
Failed checks: 2 inconclusive
Check name
Status
Explanation
Resolution
Linked Issues check
Directly linked issue #4263 requires that a rebuild's software retry still running at the 30-second manifest deadline is kept and registered. A retry that exited without output must still fail. The he…
Provide readable evidence of the head implementation of the rebuild startup path in internal/transcodenode/server.go, including startReconstructProcess and its call to playback.StartReconstructTranscode, or the relevant hunks of internal/pl…
Out of Scope Changes check
The head diff of internal/transcodenode/server_test.go adds one regression test for #4263 and one test override field, reconstructStartupWait. The change summary states that the rebuild path in server…
Provide readable server.go evidence for the head rebuild path. Show whether the CPU-decode retry for rebuilds changes the behavior of a rebuild after a GPU decoder rejects a source. Confirm whether that behavior is required by #4263 or by a…
Passed checks: 2 passed
Check name
Status
Explanation
Title check
The title names the change: a rebuild's software retry that is still starting is kept instead of closed. The raw summary and objectives confirm the retry path in startReconstructProcess and the new te…
Description check
The description states the problem (rebuilt transcode software retry closed at the 30-second startup deadline while still running), the approach (startReconstructProcess now calls playback.StartRecons…
Full details: Title check
Explanation
The title names the change: a rebuild's software retry that is still starting is kept instead of closed. The raw summary and objectives confirm the retry path in startReconstructProcess and the new test. The title is specific and accurate, though it omits the shift to the shared StartReconstructTranscode path.
Full details: Description check
Explanation
The description states the problem (rebuilt transcode software retry closed at the 30-second startup deadline while still running), the approach (startReconstructProcess now calls playback.StartReconstructTranscode with TranscodeStartupRetryAccelChange), the new test, validation, and risks. It is specific to the changeset, so it is not off-topic or vague.
Full details: Linked Issues check
Explanation
Directly linked issue #4263 requires that a rebuild's software retry still running at the 30-second manifest deadline is kept and registered. A retry that exited without output must still fail. The head changed since the previous review. The head diff for internal/transcodenode/server_test.go adds TestSpawnReconstructKeepsSlowSoftwareRetry. It sets reconstructStartupWait to one second, runs a hardware attempt that exits, and runs a software retry that stays running. It then requires a returned, running, registered session and two real hls attempts. The test encodes the #4263 requirement. The implementation could not be verified. The diff for internal/transcodenode/server.go was unavailable. A file read at head was truncated before startReconstructProcess. The change summary states that the explicit-backend branch was replaced by playback.StartReconstructTranscode, with a net change of +17/-59 lines. The previous PASS relied on the earlier IsRunning() conditional, which no longer describes the head. The PR description also reports test results only for 8ab8feb, not for eeb95fb. Whether the shared path keeps a running software retry and fails an exited one at head is not established.
Resolution
Provide readable evidence of the head implementation of the rebuild startup path in internal/transcodenode/server.go, including startReconstructProcess and its call to playback.StartReconstructTranscode, or the relevant hunks of internal/playback/transcode_startup.go. Also provide the result of go test for TestSpawnReconstructKeepsSlowSoftwareRetry and TestSpawnReconstructDoesNotRegisterFailedSoftwareRetry at eeb95fb. This evidence confirms that a running software retry is kept and an exited one fails at head.
Full details: Out of Scope Changes check
Explanation
The head diff of internal/transcodenode/server_test.go adds one regression test for #4263 and one test override field, reconstructStartupWait. The change summary states that the rebuild path in server.go now delegates to playback.StartReconstructTranscode, with the same acceleration-change retry policy as fresh starts. This removes the former explicit-backend branch. The PR objectives state that the shared policy also permits a CPU-decode retry when the GPU decoder rejects a source. #4263 does not request that behavior. It concerns only the software retry's readiness deadline. The refactor and the CPU-decode retry may be needed to reuse the shared path, but the code that establishes this was unreadable. The current PR description also still describes the earlier 7-line IsRunning() conditional and says nothing visible changes. It does not describe the head refactor or the new retry behavior. Whether this change is in scope cannot be decided from the available evidence.
Resolution
Provide readable server.go evidence for the head rebuild path. Show whether the CPU-decode retry for rebuilds changes the behavior of a rebuild after a GPU decoder rejects a source. Confirm whether that behavior is required by #4263 or by a linked issue. Update the PR description to describe the head approach and its user-visible effects. Alternatively, split the CPU-decode retry into a separate change if it is not required by #4263.
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 43373d13-554d-41ca-9562-ab3da93397de
Commits
Reviewing files that changed from the base of the PR and between f4a250c and eeb95fb.
Files selected for processing: 2
internal/transcodenode/server.go
internal/transcodenode/server_test.go
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.
Could a maintainer rerun the failed jobs? "ci / Go test" and "ci / Go integration" both failed in the Set up Go step, before any test ran: the apt install of the libvips packages hit the step's 60-second limit on a slow mirror (duration_ms=60019 and 60021). I can't rerun jobs from my account.
…rting
When a rebuild's hardware encode died at startup, the node started a
software retry and waited 30 seconds for its first manifest. A retry
still running at that deadline was closed, its output directory removed,
and the rebuild failed, although FFmpeg might have written output a few
seconds later. The next request then started the rebuild over from the
hardware attempt.
A retry still running at the deadline is now kept and registered, as a
slow first attempt already is, so the segment path serves it once output
appears. A retry that exited without output still fails.
ClosesSilo-Server#4263
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 7d6e33dd-c4d5-458d-b224-2f569b85d684
Commits
Reviewing files that changed from the base of the PR and between 8ab8feb and f4a250c.
Files selected for processing: 1
internal/transcodenode/server.go
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Major · Stability & Availability · Heavy lift
Recover a registered retry that exits before its first manifest.
A software retry that exits after registration stays in the session map. Nothing removes it on exit. Manifest requests for a copy-video, unknown-duration, or oversized session keep using that session. They do not reconstruct it, so they return a manifest error or an older manifest from the reused output directory. Each request also refreshes the session's idle clock, so the reaper does not remove it while a client polls. Segment requests can restart ffmpeg in place, so the failure is limited to the manifest path.
Require that a registered retry which exits without writing its manifest stop being served as a live session. The next manifest request must then reconstruct it, as it does for a missing session.
The reason will be displayed to describe this comment to others. Learn more.
Agreed that the case exists, but it isn't new to this path. The slow first attempt at server.go:2321 is already kept and registered the same way when it misses the deadline while running, and it has the same exposure if it later exits without a manifest: handleManifest (server.go:2798) serves any registered session and rebuilds only a missing one. This PR gives the software retry the same treatment instead of closing it and failing the rebuild. The right fix covers both: when a registered session has stopped running and has no manifest, unregister it so the next manifest request rebuilds it. That touches the manifest path for every session, so I'd rather do it as a follow-up than widen this PR. I haven't reproduced the exit-after-deadline case; this comes from reading the code.
startReconstructProcess kept its own copy of the start, wait and software
retry that playback.StartReconstructTranscode already implements, and Silo-Server#4263
came from that copy drifting. Pass the node's TranscodeStartupRetryAccelChange
policy to StartReconstructTranscode instead, as handleStart does for fresh
starts. It waits for the current generation's manifest, keeps an attempt
still running at its deadline, and stops a failed attempt with CloseProcess
before the retry, so the behavior Silo-Server#4263 asks for holds for every attempt.
A rebuild on these backends now also gets the CPU-decode retry when the GPU
decoder rejects the source, as a fresh start does.
Tests set the new reconstructStartupWait field so the slow-retry test takes
one second instead of the full 30-second startup timeout.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
🤖 Claude Code (claude-opus-5-5)
The fix is correct: the new test fails on main with manifest not ready after 30s: ffmpeg still running and passes on this head, and a retry that is still running is now handled like a slow first attempt. Two findings below. I'm fixing both in a commit on this branch, so there's no need to change anything yourself.
The fake hardware attempt must exit inside the startup wait for the test to
reach the software retry. Three seconds leaves room on a loaded runner.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reviewed head: 6e4d6fc4b6 (contributor commit f4a250c8e2 plus two review commits).
The fix for #4263 is correct. The new test fails on main with manifest not ready after 30s: ffmpeg still running and passes on this head.
Addressed in this review
eeb95fbfe0: the node's rebuild now calls playback.StartReconstructTranscode with TranscodeStartupRetryAccelChange, the policy fresh starts on the node already use, instead of keeping its own copy of the start, wait and retry. That copy drifting is what caused [bug] A transcode node closes a rebuild's software retry that is still starting #4263. A side effect, matching fresh starts: on these backends a GPU decoder rejection gets a CPU-decode attempt before full software.
eeb95fbfe0 and 6e4d6fc4b6: tests can shorten the rebuild's startup wait through an unexported Server field (zero keeps 30 s). The new test now takes 3 s instead of 30 s. With the shared path changed to drop a slow retry, the test still fails, so it still guards the bug.
Left for maintainers, outside this PR
A kept session whose FFmpeg exits later without writing a playlist stays registered, and manifest polls keep it from being reaped. This already applies to a slow first attempt and to the shared rebuild path. The author proposed a follow-up. It is not confirmed as a user-visible failure.
The API server's own rebuild path (internal/playback/transcode_manager.go) passes no legacy retry, so an explicit VideoToolbox rebuild there may not fall back to software. Not traced far enough to confirm.
Validated features: the reachable passed cases are #1177 C3 and #1178 C2 (node failover and session recovery). They need the hardware attempt to die at startup and the software retry to still be running at the deadline, which they didn't exercise, so neither changes. Validation tasks: none is correct.
User manual: unaffected. It doesn't describe how a rebuild retries.
Other clients: none. Server-only, no API change.
Council: Sol (gpt-6.2-sol, medium), Opus (claude-opus-5-5, medium), Gemini (gemini-4-neon, medium).
Round 1 on f4a250c8e2: Sol 7, Opus 7, Gemini 7.5. All three recommended the shared startup path.
Round 2 on eeb95fbfe0: Sol 8, Opus 9, Gemini 9.5. No new defects. Two members noted the 1 s test wait could flake on a loaded runner, so 6e4d6fc4b6 raised it to 3 s.
Fit: 9/10 · Readiness: 9/10 — ready (assuming CI is green)
Fit: a correctness fix for node failover. With the review commit it removes a duplicate code path, and it adds no setting or API surface.
Readiness: a test that failed on main shows the fix, the reconstruct tests and the transcodenode and playback packages pass, and the validation check ran. It has not been reproduced on real VideoToolbox or QSV/VAAPI hardware.
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
bugSomething isn't workinggoPull requests that update go codeimpact: playbackCan't play, stalls, or wrong mediapriority: P2Limited scope, workaround exists, or polishsize/M50–199 added + deleted lines (all files); change volume, not priority.
2 participants
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.
Depends on: none. Builds on #4251, which has merged. Merge order: none.
Problem
Closes #4263
Related issue: N/A
Validation tasks: none
Other clients: N/A (no client-visible change)
On a transcode node, when a rebuilt transcode's hardware encode died at startup, the node started a software retry and waited 30 seconds for its first manifest. If the retry was still running at that point, the node closed it, removed the session's output directory and failed the rebuild, even though FFmpeg might have written output a few seconds later. The next request then started the rebuild again from the hardware attempt. This affects nodes whose backend has a software retry: VideoToolbox, or QSV/VAAPI with no render device.
With this change a retry that is still running at the deadline is kept, like a slow first attempt.
Approach
The node's rebuild had its own copy of the start, wait and software-retry logic, and #4263 came from that copy drifting from the shared one.
startReconstructProcessnow callsplayback.StartReconstructTranscodewithTranscodeStartupRetryAccelChange, the policyhandleStartalready uses for fresh starts on the node. That path waits for a manifest the current process wrote (#4099), keeps any attempt still running at its deadline, retry included, and stops a failed attempt withCloseProcessbefore the retry. A retry that exited without output is closed and fails as before.A rebuild on these backends also gets the CPU-decode retry when the GPU decoder rejects the source, as a fresh start does.
Tests set a new unexported
Server.reconstructStartupWait, passed as the startup timeout (zero keeps the 30 s default), so the new test takes 3 s.Validation
spawnReconstructwith a fake FFmpeg: the VideoToolbox attempt exits, and the software retry runs without writing a manifest. It fails onmainwithmanifest not ready after 30s: ffmpeg still runningand passes on this head. It also fails when the shared startup path is changed to drop a slow retry.go testforinternal/transcodenodeandinternal/playback: pass.make lint-changedagainstmain: 0 issues.Evidence
Nothing visible changes. The page has the test output before and after.
Evidence: https://evidence.siloserver.org/r/silo-server/pr-4504/
Risks
Checklist
AI Disclosure
f4a250c8e2; their findings are handled ineeb95fbfe0, which a second round reviewed with no new defects.6e4d6fc4b6only lengthens the test's wait.🤖 Generated with Claude Code
Note
Fix
transcodenode.Server.startReconstructProcessto keep software retries still startingtranscodenode.Server; zero keeps the default timeoutstartReconstructProcessno longer runsMacroscope summarized 6e4d6fc.