Dezio/docs/tests/S002-outbound-timeouts.md
2026-12-01 22:46:37 -06:00

4 KiB

S002 — Timeouts on every outbound call: test file

Written by the worker that built it, run by the test phase. Nothing here has been tested until its Result says so.

Built

Audit of child processes and their limit (all kill on drop or on timeout):

  • yt-dlp / ffmpeg / gallery-dl in download/tools.rs run_lines (shared helper: limit, cancel, kill; probe 120 s). Unchanged.
  • ffmpeg::run 60 s+ per caller, kill_on_drop. Unchanged.
  • ffmpeg::inspect (ffprobe): 60 s, now kill_on_drop (before, the timeout dropped the future and left ffprobe running).
  • ffmpeg::probe (ffprobe local file): had NO limit; now PROBE_SECONDS 60 s + kill_on_drop, returns None on timeout.
  • Music stream ffmpeg (source::spawn_pipe) and peaks: no total limit (songs run for hours); now -rw_timeout 20 s (STREAM_IDLE_MICROS) = cut when no data for 20 s. peaks also gives up when a read stalls 30 s (PEAKS_IDLE).
  • music/ytdl.rs lookup, lastfm/extras.rs yt-dlp and ffmpeg: already 120 s timeout + kill_on_drop. Aki curl: -m 15 + kill_on_drop.
  • Tests-only spawns (std::process::Command in test modules) left alone. HTTP: shared client state.web 20 s total (covers body); per-call timeouts set in search, covers, lastfm api, virus, translate, actions, animals, activity; fetch_limited 60 s + size cap + safe_url. covers.rs own client has timeout. Discord client 180 s (S001). Test-only clients without timeout left. Not changed: timeouts keep their existing card text ("took too long" strings); no bail_user! rewrite.

Checks

# Risk Do this Expect How Result
1 HIGH Play a song, then block the stream host (firewall rule or pause the server) ffmpeg ends after about 20 s without data; player moves on or shows an error, no hung process by hand not run: needs live voice and a firewall
2 HIGH /convert a URL to a host that accepts and never answers ffprobe killed within ~60 s (pgrep ffprobe empty), card appears by hand not run: needs a hanging host; kill path covered by unit test stuck_child_is_killed_at_the_limit
3 MED Run ffmpeg::probe on a FIFO/blocked path returns None after 60 s, process gone by hand not run: needs a FIFO and 60 s; code read: timeout + kill_on_drop
4 MED /play song, let the loudness pass run with a stalled link peaks returns None after 30 s idle; playback unaffected by hand not run: needs live music
5 MED Start /download of a slow link, cancel yt-dlp child gone by hand pass (unit test cancel_ends_a_running_child)
6 MED Serve a page that sends one byte per second to /search, /image fetch gives up by the 20 s client timeout by hand not run: needs a slow server; code read: reqwest client timeout 20 s
7 MED fetch_limited against a 50 MB file returns None at the size cap by hand pass (code read: fetch_limited checks content-length and running size)
8 LOW rg "Command::new" src every non-test spawn has a timeout or idle limit by hand pass (rg: non-test spawns are ffmpeg.rs, tools.rs run_lines, aki curl -m 15, music source with -rw_timeout)
9 LOW Normal song plays with -rw_timeout plays, seek works by hand not run: needs live music
10 MED Make /convert run past its limit reply says "The conversion took too long ..." by hand not run: needs Discord
11 LOW Make a /play lookup time out reply says "The song lookup took too long ..." by hand not run: needs Discord

Needs

A test server or local slow HTTP server (python), a Discord test guild; never the real token on this PC.

Doubts

  • -rw_timeout on HTTP inputs: assumed supported by the server's ffmpeg build (HTTP protocol option, µs). Verify song playback and that a stall really ends the process.
  • Timeout messages from string-returning helpers (ffmpeg::run, ytdl::extract, make_song, VirusTotal wait) are plain strings that callers show as a "❌ ..." reply, not bail_user!: the helpers can't return UserError. Check the text reads well in each (checks 10-11).