Repository navigation
Description
What happened
When a Jellyfin play's native session goes away while the play's first local transcode is starting, the start still registers and serves the transcode. The play's row is still live, so the start is not rolled back when it stores its recipe; it logs that the session is unavailable and carries on. With the session gone, nothing expires the transcode, so FFmpeg keeps encoding if the client does not come back.
If the client keeps playing, its next segment request registers the session again and the play recovers. The transcode is left running only when the client goes away.
#4128 closes the same gap for a transcode rebuilt from a stored recipe. This is the other branch of the same function, a start with no usable recipe.
Steps to reproduce
Not reproduced on a deployment. The trigger, from the source and a focused run:
- Start a transcoded stream from a Jellyfin client on a single-server deployment (integrated transcoding).
- Have the play's native session removed while FFmpeg is starting: by session expiry, or by anything else that stops the session and leaves the play's row routable.
- The start registers its transcode after the session is gone.
A focused run on main called the local transcode start for a play with a live row, a native session, and no recipe, and stopped the session from the test seam the start calls before it launches FFmpeg. The start returned a transcode with no error. Afterwards the transcode was registered, the native session was gone, the play's row was live, and no recipe had been stored.
Expected behavior
A start that finds the native session gone closes its transcode, as a rebuild does after #4128, and leaves the play resumable.
Silo version / commit
main at b6b7dd3
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
Any locally transcoded stream.
Diagnostics report reference
No response
Relevant logs
From the focused run, with the timestamp removed:
WARN record transcode stream details failed component=jellycompat error="playback session not found" playback_session_id=upstream-1
WARN transcode recipe not persisted: upstream session unavailable component=jellycompat playback_session_id=upstream-1
Technical notes
Line numbers are for b6b7dd3.
internal/jellycompat/streams.go:3060:ensureTranscodeSessionWithToneMapMode. The start registers its transcode at:3241(and at:3274and inawaitCompatAutoTranscodefor the fallback paths) and publishes it from:3308.internal/jellycompat/handlers_playback.go:2206:persistTranscodeRecipe. With no native session it logs and leaves the transcode serving (:2241). Its doc comment says this is deliberate for a start and build race and for tests with no session manager, so a fix has to keep those tests working.- A start whose play has been stopped or ended by an administrator is already rolled back: the row is terminal or deleted, the recipe write returns not found, and the caller closes the transcode.
This follows #4128: a fix here would reuse the error, the 404 answer, and the skipped teardown that pull request adds in the same function.
AI harness
Claude Code (T3 Code)
AI tool(s)
Claude Code review subagents, T3 Code delegated review, git, Go (go test)
AI model(s)
claude-fable-5-2, gpt-6.1-sol
AI involvement
Fully AI-generated (not yet human verified)
Independent or adversarial review
Found by Claude Code review subagents while reviewing #4128, and confirmed by claude-fable-5-2 with the focused run 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 #4128
Activity
fix(jellycompat): close a first transcode whose play's session ended …