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
[bug] Expiring a stale Jellyfin-compat session copy stops the node job another replica is serving #2845
When an API replica's copy of a Jellyfin-compat playback session expires, the replica stops the session's job on the transcode node, even if another replica is still serving that session. The client on the other replica loses its stream in the middle of playback.
Jellyfin-compat sessions use the upstream session ID as the node transport ID, and ensureUpstreamPlayback (internal/jellycompat/streams.go) rebuilds the upstream session on whichever replica receives a request. Once requests move to replica A, replica B's copy goes idle and expires. Two expiration hooks then run on B, and both send DELETE /transcode/{id} to the node for the job A is serving:
The jellycompat hook, handleExpiredSession in internal/jellycompat/handlers_playback.go, calls CloseTranscodeSession(session.ID, session.TranscodeNodeURL) with no stale-copy check.
The native hook, expireSessionCopy in internal/api/handlers/playback.go, skips the stop only when the v3 attempt row shows activity elsewhere. A Jellyfin-compat session has no v3 attempt row, so it falls through to finalizeSessionStop.
The node's stop also deletes the stored recipe. Jellyfin segment requests carry no stream token, so the node cannot rebuild the job, and A's next segment request fails (404 on main; 410 once #2355 lands).
The trigger and the wrong result were traced through the code on main. Nothing was reproduced live.
Expected
A replica that drops a stale copy of a Jellyfin-compat session leaves the remote job alone while another replica still serves it, as the native path does for v3 sessions.
Notes
The native half of the fix touches expireSessionCopy, which #2355 changes, so the fix should follow that PR.
Activity