Skip to content

[bug] A rebuilt transcode on an explicit hardware backend fails with context canceled when the request that triggered it ends before FFmpeg starts #4113

Closed

Description

@Quick104

What happened

With an explicit hardware backend (or software), a rebuilt transcode fails with context canceled for every request waiting on it when the request that triggered the rebuild ends before FFmpeg starts. It affects an HEVC target, a bitrate-capped VAAPI encode, a tone-mapped stream, and a stream with burned-in text subtitles.

A rebuild is shared: concurrent manifest and segment requests for one lost session wait on a single rebuild. Outside Hardware acceleration = Auto the rebuild starts FFmpeg once, on the triggering request's context. If that request has ended, StartTranscode returns its error before FFmpeg runs, nothing is registered, and the other waiting requests get the error.

#4110 fixes the same failure for the Auto path. This is the path it does not touch.

Steps to reproduce

Not reproduced on a deployment. The trigger, from the source and a focused run:

  1. Set Hardware acceleration to a specific backend (for example NVENC or VAAPI), or to none.
  2. Have a transcode session with one of the recipes above lose its FFmpeg process, so the next request rebuilds it.
  3. Let two requests reach the rebuild. The one that triggers it disconnects before the rebuild starts FFmpeg.

A focused test that called the real StartTranscode with an already-cancelled context returned:

  • H.264 on software, NVENC, QSV, and uncapped VAAPI: session returned, no error
  • HEVC on software and on NVENC: context canceled
  • H.264 on VAAPI with a bitrate cap: context canceled
  • Burned-in text subtitles: context canceled

Expected behavior

A rebuild serves every request waiting on it, so once it is admitted it should start whether or not the request that triggered it is still connected.

Silo version / commit

main at 2e05489

Deployment

Other

Area

Playback and transcoding

Clients affected

  • Web UI
  • Android
  • iOS/tvOS/macOS
  • Jellyfin-compat client (Infuse, Findroid, ...)
  • Other/not client-specific

Client app and device

No response

Media and playback details

HEVC target, capped VAAPI encode, tone-mapped stream, or burned-in text subtitles, on an explicit backend or software.

Diagnostics report reference

No response

Relevant logs

No logs available.

Technical notes

Line numbers are for 2e05489.

  • internal/playback/transcode_startup.go:88: the no-fallback branch of StartReconstructTranscode returns startup.start(ctx, pipeline.Current()) with the request context. The integrated manager reaches it for every rebuild outside Auto, because internal/playback/transcode_manager.go:1053 passes no legacy retry.
  • internal/transcodenode/server.go:2305: the node's rebuild outside Auto calls playback.StartTranscode(r.Context(), opts).
  • StartTranscode returns a cancelled context's error at internal/playback/hevc_encoder.go:55, internal/playback/vaapi_rate_control.go:53, the tone-map source check (internal/playback/transcode.go:498), and burn-in subtitle staging (internal/playback/transcode.go:2165).
  • The error returns from the rebuild to every caller sharing it (internal/playback/transcode_manager.go:933, internal/transcodenode/server.go:2107).
  • Related, and by design today: admission also runs on the triggering request's context. acquireReconstructSlot (internal/playback/transcode_manager.go:1013, internal/transcodenode/server.go:2272) returns that request's error to every waiter when it ends while queued. A fix here should decide whether the waiters should get that error.

This follows #4097, which rewrites both start lines and still launches the first start on the request context. A fix should start from main after #4097 merges.

AI harness

Claude Code (T3 Code)

AI tool(s)

Claude Code review subagents, git, Go (go test)

AI model(s)

claude-fable-5-2

AI involvement

Fully AI-generated (not yet human verified)

Independent or adversarial review

Found by three review agents during the code review of #4110, then confirmed by a separate review agent that ran the focused test above. Not yet checked by a person.

Confirmations

  • I searched open and recently closed issues and pull requests, and this is not already reported
  • I reproduced this myself on a real deployment
  • Any logs provided are raw apart from marked redactions and are not AI-summarized; if none were available, I said so above

Source: found in review of #4110

Activity

  1. added
    bug
    on Nov 13, 2026
  2. added
    impact: playback
    priority: P2
    on Nov 13, 2026
  3. self-assigned this
    on Nov 13, 2026
  4. Quick104 commented on Nov 13, 2026

    @Quick104
    ContributorAuthor

    🤖 AI agent claim. Claude Code (claude-fable-5-2) is working on a fix for this issue on behalf of @Quick104, who is assigned.

    A pull request will link here when the fix is ready. If the work stops without a fix, the assignment and this comment are removed.

    Planning to work on this, or have context to add? Reply here and mention @Quick104.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugimpact: playbackpriority: P2

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions