openhuman icon indicating copy to clipboard operation
openhuman copied to clipboard

Memory queue floods Sentry on disk-full: SQLITE_FULL not classified, worker re-polls every 1s

Open oxoxDev opened this issue 5 months ago • 1 comments

Source

Sentry: TAURI-RUST-4R8 (tauri-rust, self-hosted) Events: ~95,035 · Users affected: 1 · First seen: 2026-05-27 · Last seen: 2026-06-22 Still arriving on builds newer than #3672 (events on 0.57.18 + 0.57.40).

Symptom

Failed to claim next mem_tree_jobs row: database or disk is full: Error code 13: Insertion failed because database is full

A single user with a full disk produced ~95k error events.

Root cause

On a full disk, claim_next (src/openhuman/memory_queue/store.rs:140) gets SQLITE_FULL (primary code 13). The memory-queue worker (src/openhuman/memory_queue/worker.rs:117-155) classifies only BUSY/LOCKED and the IOERR family as transient (back off, no report). SQLITE_FULL matches neither → falls to the else arm → report_error(...) and re-polls every 1s → a tight Sentry storm for a condition only the user can clear.

The before_send classifier is_disk_full_message (src/core/observability.rs:557) would demote it, but its suffix anchor (ends_with("database or disk is full")) misses the rusqlite extended-code rendering, where the canonical phrase is mid-string followed by : Error code 13: Insertion failed because database is full. #3672 added that suffix arm for the bare commit tx: database or disk is full shape (TAURI-RUST-B6N) and did not touch the worker.

Bug shape

Silent-failure / retry-storm — a genuinely unpreventable host condition (disk full) turned into 95k events by a 1s re-poll with no backoff and no classification.

Proposed fix

  1. worker.rs: add an is_sqlite_disk_full classifier (downcast to ErrorCode::DiskFull + text fallback); new match arm before else → long backoff, log::warn, no report_error. Mirrors the existing is_sqlite_io_transient arm. Jobs stay ready and resume when disk frees (claim is a lease UPDATE — no data loss).
  2. observability.rs: extend is_disk_full_message to also anchor on the SQLite-specific insertion failed because database is full token (guarded by the existing !backend returned exclusion) so the extended-code rendering demotes on any write path, not just the worker.

Plus unit tests on both layers constructing the exact SqliteFailure(DiskFull, 13).

oxoxDev avatar Jun 22 '26 10:06 oxoxDev

Picking this one up. The full-disk SQLITE_FULL falls past the worker's busy/IO classifiers into the report-and-repoll arm, so I'll add a disk-full classifier with a long backoff (no Sentry report) and extend the before_send matcher to catch the extended-code rendering, with unit tests on both.

obchain avatar Jun 22 '26 11:06 obchain