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
#151 subtitle prefetcher can exit mid-playback and is never restarted #231
Found by @rrgomes while reading the software path for #220. They have a session where the prefetcher exited with cancelled=false harvested=22 in the middle of playback, with nothing bringing it back.
SubtitleForwardPrefetcher.run leaves its loop on the first failed read:
guardletpkt=try?demuxer.readPacket()else{break}
Any read error ends the session, not just EOF: a transport failure on the side reader, a stall that exhausts the read deadline, a reconnect that gives up. The only thing that starts a new one is startSubtitleForwardPrefetcher, and after the initial selection that happens exclusively through prefetchNeedsReanchor on a drain-tick jump, which means a seek or a producer re-anchor. A viewer who does not seek never gets the reader back.
The failure is silent in the sense that matters: the exit line reports cancelled=false, but the consequence (subtitles beyond the pump's own forward park quietly starve for the rest of the session) has no signal of its own. The reporter's session had subtitles simply stop being available ahead of the playhead.
Two parts to fix:
Distinguish EOF from an error at the exit. EOF is the expected end of a prefetch session, an error is not.
Restart on error, bounded. The native subtitle readers and the pump both already have restart paths to mirror; the side reader should not be the one component whose death is terminal for the session.
The #220 census build now carries prefetch=off/read/park/dead in the periodic memprobe, so a session that harvested and then stopped is at least visible in a field log while this is open.
Both parts are in. run now returns why it stopped, so EOF, cancellation, a source that will not open and a read failure are four distinct exits, and the exit line names the reason instead of reporting cancelled=false for all of them. Only a read failure restarts.
The restart is bounded by two ceilings, because the two failure shapes look different on the wire. A run of failures with nothing harvested between them is a dead link and runs out after three attempts, backing off 1s, 2s, 4s. A session that harvested cues and only then broke is a fresh transport failure and gets a fresh budget; that is the session in this report, harvested=22 and then gone. A total ceiling of eight restarts keeps a source that fails in a loop after one packet each time from reconnecting forever. Each attempt re-anchors at the current playhead rather than the original one, and takes its own independent reader on a custom source.
Exhausting the budget now logs what it costs rather than going quiet, which was the part with no signal of its own:
#151 forward prefetch giving up after 8 restarts (3 consecutive): cues beyond
the pump's forward park will not be filled for the rest of this session
Coverage: the EOF-versus-error classification is tested through the real FFmpeg stack, with a reader that reports a hard error mid-session rather than an EOF, plus the budget arithmetic. The restart loop's wiring to the engine is not covered by a test, since it needs a loaded session.
Note that #230, found in the same pass, is fixed alongside this one, and the two interact: a reader that never parks is also a reader that is far more likely to hit a transport failure.
Closing directly for the same reason as #230: found by reading, no symptom to reproduce. The EOF-versus-error classification is pinned by Issue231PrefetchRestartTests through the real FFmpeg stack, with a reader that reports a hard error mid-session rather than an EOF, and the restart budget is covered separately.
One honest gap: the restart loop's wiring to the engine has no test of its own, since it needs a loaded session. If a prefetcher is ever seen staying down after a read failure in the field, that wiring is the first place to look, and the exit line now names the reason it stopped.
Activity
fix(subtitles): restart the forward prefetcher when a read fails (#231)
superuser404notfound commentedon Jul 27, 2026
Fixed on main in a05b55c, not yet in a release.
Both parts are in.
runnow returns why it stopped, so EOF, cancellation, a source that will not open and a read failure are four distinct exits, and the exit line names the reason instead of reportingcancelled=falsefor all of them. Only a read failure restarts.The restart is bounded by two ceilings, because the two failure shapes look different on the wire. A run of failures with nothing harvested between them is a dead link and runs out after three attempts, backing off 1s, 2s, 4s. A session that harvested cues and only then broke is a fresh transport failure and gets a fresh budget; that is the session in this report,
harvested=22and then gone. A total ceiling of eight restarts keeps a source that fails in a loop after one packet each time from reconnecting forever. Each attempt re-anchors at the current playhead rather than the original one, and takes its own independent reader on a custom source.Exhausting the budget now logs what it costs rather than going quiet, which was the part with no signal of its own:
Coverage: the EOF-versus-error classification is tested through the real FFmpeg stack, with a reader that reports a hard error mid-session rather than an EOF, plus the budget arithmetic. The restart loop's wiring to the engine is not covered by a test, since it needs a loaded session.
Note that #230, found in the same pass, is fixed alongside this one, and the two interact: a reader that never parks is also a reader that is far more likely to hit a transport failure.
Thanks for catching this.
superuser404notfound commentedon Jul 27, 2026
Released in 5.23.11.
Closing directly for the same reason as #230: found by reading, no symptom to reproduce. The EOF-versus-error classification is pinned by
Issue231PrefetchRestartTeststhrough the real FFmpeg stack, with a reader that reports a hard error mid-session rather than an EOF, and the restart budget is covered separately.One honest gap: the restart loop's wiring to the engine has no test of its own, since it needs a loaded session. If a prefetcher is ever seen staying down after a read failure in the field, that wiring is the first place to look, and the exit line now names the reason it stopped.
Merge main (5.23.11) into the #220 diag branch
feat(subtitles): generation-fenced subtitle-resolution statement (sup…
fix(subtitles): native readers tell a transport error from EOF and re…