Skip to content

feat: add MakeMKV I/O watchdog to prevent runaway read retry storms#18

Open
negativeeddy wants to merge 1 commit into
masterfrom
feat/io-watchdog
Open

feat: add MakeMKV I/O watchdog to prevent runaway read retry storms#18
negativeeddy wants to merge 1 commit into
masterfrom
feat/io-watchdog

Conversation

@negativeeddy

Copy link
Copy Markdown
Owner

Problem

The container vigorous_borg became unresponsive because makemkvcon accumulated 450GB of block I/O on a single disc. This saturated the storage subsystem, starving SQLite and the ASP.NET request pipeline, causing the web UI to deadlock.

Solution

A new MakemkvIoWatchdog background service that monitors makemkvcon process I/O via /proc/[pid]/io and cancels jobs that exceed a configurable threshold.

Changes

New file

  • src/ArmRipper.Core/Infrastructure/MakemkvIoWatchdog.csBackgroundService that:
    • Polls every 30s (configurable) while active rips exist
    • Reads physical block I/O (read_bytes) from /proc/[pid]/io per makemkvcon process
    • If any process exceeds the threshold (default: 150 GiB = ~3× BDXL), it cancels the job via BackgroundRipService.CancelRip() → CTS token cascade → CliProcessRunner.Kill(entireProcessTree: true)
    • Extracts device path from /proc/[pid]/cmdline to map the process to the correct job
    • Falls back to kill -TERM if no matching job can be found
    • Disables itself when MakemkvMaxReadBytes = 0 or on non-Linux

Modified files

  • ArmSettings.cs — Added MakemkvMaxReadBytes (default: 150 GiB) and MakemkvIoWatchdogIntervalSeconds (default: 30)
  • ArmYamlConfigLoader.cs — Added YAML key mappings for MAKEMKV_MAX_READ_BYTES and MAKEMKV_IO_WATCHDOG_INTERVAL
  • Program.cs (WebUi) — Registered MakemkvIoWatchdog as a hosted service

Build

  • Full solution builds with 0 warnings, 0 errors
  • Pre-existing test failures unchanged (unrelated)

Config example (arm.yaml)

MAKEMKV_MAX_READ_BYTES: 161061273600   # 150 GiB
MAKEMKV_IO_WATCHDOG_INTERVAL: 30       # polling interval (min 10)

Set MAKEMKV_MAX_READ_BYTES: 0 to disable.

Closes the I/O watchdog item from the vigorous_borg investigation.

Adds MakemkvIoWatchdog, a BackgroundService that monitors makemkvcon
process I/O via /proc/[pid]/io and cancels jobs that exceed a
configurable threshold (default 150 GiB). This prevents scratched or
damaged discs from saturating container I/O and starving the ASP.NET
request pipeline.

New config settings (ArmSettings):
- MakemkvMaxReadBytes (default: 161061273600 = 150 GiB)
- MakemkvIoWatchdogIntervalSeconds (default: 30, min: 10)

YAML keys: MAKEMKV_MAX_READ_BYTES, MAKEMKV_IO_WATCHDOG_INTERVAL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant