Skip to content

[bug] Chapter thumbnail extraction times out on high-latency media #688

Closed as not planned

Description

@tomislav

What happened

The chapter-thumbnail worker repeatedly fails on media whose first decodable frame takes longer than Silo's fixed extraction deadline.

Production is running chapter extraction in software (hw_accel=none). The current deadlines are 10 seconds for CPU SDR and 25 seconds for CPU HDR. On an affected SDR chapter, Silo killed FFmpeg at 10 seconds. Running the same FFmpeg arguments against the same media inside the same container, without Silo's deadline, exited successfully in approximately 27.3 seconds.

The container has no memory limit and its cgroup reported zero oom and oom_kill events.

The timeout is currently reported as chapter_extract_failed: ... signal: killed, not cpu_timeout. Generic extraction failures remain on the per-chapter retry schedule (15 minutes, 1 hour, 6 hours, then 24 hours), so the hidden six-hour backfill task keeps revisiting affected files. Production recorded 295 chapter extraction warnings during the retained eight-day window; three timeout-pattern files accounted for 216.

Relevant code:

  • internal/chapterthumbs/service.go: extraction deadlines and retry behavior
  • internal/chapterthumbs/extractor.go: runFFmpegFrameExtract and classifyExtractError
  • internal/taskmanager/tasks/chapter_thumbnail_backfill.go: backfill trigger

Steps to reproduce

  1. Run Silo build 415 in Docker with chapter thumbnails enabled.
  2. Use a media file on high-latency/on-demand storage whose frame extraction takes more than 10 seconds.
  3. Let the chapter-thumbnail backfill process the file.
  4. Observe that FFmpeg is killed at the CPU SDR deadline and the warning reason is chapter_extract_failed.
  5. Resolve the affected path from its media_files row and run the same generated command inside the Silo container without Silo's context deadline:
    /usr/lib/jellyfin-ffmpeg/ffmpeg -hide_banner -loglevel error \
      -ss 2011.339 -i "$MEDIA_PATH" \
      -frames:v 1 -f image2pipe -vcodec mjpeg - >/dev/null
  6. Observe that the command exits successfully after approximately 27.3 seconds.

Expected behavior

Frame extraction should remain bounded but allow realistic high-latency media to complete. If the deadline is reached, the error should be classified as cpu_timeout or hw_timeout, and repeated failures should back off without indefinitely flooding warning logs.

Tests should cover context-terminated FFmpeg processes, extraction exceeding the current limits but completing under the replacement policy, and repeated-timeout retry behavior.

Silo version / commit

build-415 / 55d0578cfdf1271a74f07675c0bdf22b850c6f3b

Deployment

Docker (linux/arm64)

Clients affected

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

Relevant logs

time=2026-08-20T13:37:10.441Z level=INFO msg="chapter thumbnail processing started" component=chapterthumbs file_id=5459 priority=false target_seconds=<nil> selected_count=8 chapter_count=15 hdr_policy=best_effort
time=2026-08-20T13:37:20.444Z level=WARN msg="chapter thumbnail extract failed" component=chapterthumbs file_id=5459 chapter_index=5 reason=chapter_extract_failed error="chapter_extract_failed: ffmpeg extract frame: signal: killed ()"
time=2026-08-20T13:37:30.448Z level=WARN msg="chapter thumbnail extract failed" component=chapterthumbs file_id=5459 chapter_index=6 reason=chapter_extract_failed error="chapter_extract_failed: ffmpeg extract frame: signal: killed ()"
time=2026-08-20T13:37:40.454Z level=WARN msg="chapter thumbnail extract failed" component=chapterthumbs file_id=5459 chapter_index=7 reason=chapter_extract_failed error="chapter_extract_failed: ffmpeg extract frame: signal: killed ()"
time=2026-08-20T13:38:30.490Z level=WARN msg="chapter thumbnail extract failed" component=chapterthumbs file_id=5459 chapter_index=12 reason=chapter_extract_failed error="chapter_extract_failed: ffmpeg extract frame: signal: killed ()"
time=2026-08-20T13:38:30.495Z level=INFO msg="chapter thumbnail processing finished" component=chapterthumbs file_id=5459 priority=false generated_count=0 failed_count=8 requeue=false

AI involvement in this report

AI-generated, human verified the repro

AI tool + model

OpenAI Codex Desktop / gpt-5.6-sol

Confirmations

  • I reproduced this myself on a real deployment
  • Logs above are raw copy-paste, not AI-summarized

AI Disclosure

  • Tool(s): OpenAI Codex Desktop
  • Model(s): gpt-5.6-sol
  • Involvement: fully AI-generated
  • Adversarial review: The report was checked against raw production container logs, production database state, the deployed image metadata, cgroup memory counters, and a direct FFmpeg reproduction in the running container. The review ruled out an OOM kill and confirmed that the unchanged extraction command succeeds when allowed to run past Silo's deadline.

Activity

  1. changed the title [-]fix(chapterthumbs): tolerate slow frame extraction and classify timeout kills[/-] [+][bug] Chapter thumbnail extraction times out on high-latency media[/+] on Aug 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions