Repository navigation
fix: alert before sqlite filesystem exhaustion - #350
Conversation
pilipilisbot
left a comment
There was a problem hiding this comment.
The resolved database path, threshold checks, and systemd wiring look appropriate. Two delivery issues need fixing before merge:
- A continuing low-space alert bypasses the resend interval. The report includes changing free-space values, and should_send_alert hashes the entire report. I reproduced three sends at 2-minute intervals as the reading changed from 2.6 to 2.5 to 2.4 GiB, despite a 900-second resend interval. Deduplicate on stable alert identity while keeping current values in the message, and test consecutive low-space samples with different readings.
- A SQLite write failure can suppress the disk warning itself. The systemd invocation uses default observability persistence, and the CLI only prints the report after record_monitor_observation returns. If that write raises SQLITE_FULL (for example, the first sample after a burst fills the disk), the low-space result is dropped. Preserve the capacity warning when persistence fails and test that path. Also, inspect_db runs before the capacity probe, so a read failure can prevent the probe from running at all.
Reviewed the monitor, CLI/service integration, docs and test changes at 88a3ab5; git diff --check passed and the resend behavior was reproduced locally.
Co-authored-by: pilipilisbot <pilipilisbot@users.noreply.github.com>
|
Addressed both requested delivery fixes in 2f88d4d:
Added regressions for changing consecutive readings, failed DB inspection, and SQLITE_FULL during observability persistence. Validation: full suite 723 passed; focused monitor suite 63 passed; temporary-DB CLI smoke test passed. |
pilipilisbot
left a comment
There was a problem hiding this comment.
I reviewed the filesystem probe, thresholds, CLI/systemd wiring, and the fixes for SQLite errors and changing capacity readings. The earlier issues are addressed at the report level, but one blocker remains in notification delivery.
In monitor_alert.py, should_send_alert writes monitor-alert.state before main calls send_alert. By default that file and SQLite share the same directory. If the filesystem fills between samples, the CLI can produce the right low-space report, but ENOSPC writing the resend state still prevents notification. I reproduced this by injecting ENOSPC into save_state and verifying send_alert was never called. Please make the resend-state write best effort: log the error, still send the due alert, and add a wrapper-level regression that verifies delivery when the state write fails.
GitHub Actions passed for Python 3.11, Python 3.12, and dashboard; git diff --check passed.
Co-authored-by: pilipilisbot <pilipilisbot@users.noreply.github.com>
pilipilisbot
left a comment
There was a problem hiding this comment.
The earlier fixes now preserve the capacity report through SQLite inspection/persistence errors, throttle changing readings by alert identity, and allow delivery if writing the resend state fails. Two filesystem-error paths still bypass delivery entirely:
- In
monitor_alert.py,should_send_alert()callsload_state()outside the new error handler. If reading the existing resend file raises EIO, a low-space report that the CLI already produced is printed but never sent. Treat unreadable or malformed resend state as a cache miss, log the failure, and test that the wrapper still callssend_alert(). main()runsmaybe_unlock_stale()before sending. When stale-job handling and child inspection are enabled, a low-space report can coincide with a stale job andsample_executor_activity()can raise ENOSPC while writing its process-state file. Keep reconciliation failures visible without letting them suppress an otherwise due alert, and add a combined low-space/stale-job regression.
Reviewed the filesystem probe, threshold defaults and docs, CLI/systemd wrapper, and regression coverage. A local wrapper-level fault-injection check confirmed that both exceptions currently prevent send_alert(). GitHub Actions passed on Python 3.11, Python 3.12, and dashboard; git diff --check passed.
|
Addressed the remaining notification-delivery blocker in 76a0346:
Validation: |
Co-authored-by: pilipilisbot <pilipilisbot@users.noreply.github.com>
|
Addressed both remaining delivery paths in 0738468:
Validation: pytest -q -p no:cacheprovider (727 passed), focused monitor-alert tests (27 passed), and git diff --check. |
pilipilisbot
left a comment
There was a problem hiding this comment.
The earlier fixes for resend-state reads/writes and stale-job reconciliation are in place, but one database I/O path still drops the capacity report.
Blocking — monitor.py, DB inspection exception handler: When inspect_db() raises EIO while checking whether the DB exists, the handler calls database_path.exists() on the same path. That raises again before the monitor returns the capacity report. I reproduced this on 0738468 with a successful low-capacity probe and persistent EIO from Path.stat() only for the SQLite file. Treat existence as unknown in the handler without touching that filesystem again, and add a regression asserting that both alerts survive a failed stat.
Test isolation: test_monitor_ok_on_empty_initialized_db also failed locally because the pytest temp mount had 109 MiB / 0.2% free. Stub healthy capacity in tests unrelated to disk thresholds so a correctly initialized DB does not fail those tests based on the host mount.
Reviewed the threshold and probe logic, CLI/systemd wiring and docs, and notification resend and reconciliation paths. GitHub CI was green on Python 3.11, Python 3.12 and dashboard; git diff --check passed.
Co-authored-by: pilipilisbot <pilipilisbot@users.noreply.github.com>
|
Addressed the remaining database-I/O blocker in 8961688:
Validation in a clean Python 3.12 environment: |
pilipilisbot
left a comment
There was a problem hiding this comment.
Reviewed 8961688, including the filesystem probe, threshold configuration and systemd wiring, and the alert resend/reconciliation paths. I confirmed that an EIO on the SQLite file now preserves both the low-capacity and database-inspection alerts. GitHub Actions passed for Python 3.11, Python 3.12, and dashboard; git diff --check passed.
Blocking: a resend-state directory error still prevents the monitor from running. monitor_alert.main() calls config.state_dir.mkdir(...) before run_monitor(). If that directory is missing and the filesystem is full, or accessing the directory itself fails with EIO, the wrapper exits before it can probe capacity or send an alert. I injected ENOSPC at that call and confirmed neither run_monitor() nor send_alert() ran. Remove the eager mkdir (the state writers already create their parent directories under the best-effort handling), or make it best effort. Please add a wrapper regression that verifies a due alert is delivered when creating the state directory fails.
Co-authored-by: pilipilisbot <pilipilisbot@users.noreply.github.com>
pilipilisbot
left a comment
There was a problem hiding this comment.
Approved at 3be3277. The last blocker is resolved: the wrapper runs the monitor before attempting to create the resend-state directory. The new regression injects ENOSPC at directory creation and verifies that the monitor runs, the write failure is logged, and the due low-space alert still reaches send_alert().
I checked the resolved SQLite filesystem probe, threshold defaults and CLI/systemd wiring, and the earlier SQLite I/O and resend/reconciliation fixes. The capacity warning survives those failures, and changing free-space readings no longer reset the resend interval. No schema migration is required.
GitHub Actions passed for Python 3.11, Python 3.12, and dashboard on this head; git diff --check passed. The PR adds early warning; freeing capacity on the host is still a separate operational task.
|
Addressed the latest state-directory blocker in 3be3277:
Validation: |
|
Post-merge cleanup complete. Verified the merge into |
|
Post-merge follow-up: PR merged as |
|
Independent post-merge verification completed on current The remaining operational concern is unchanged: host disk recovery and a clean observation window are still required separately from this code merge. |
Summary
Incident evidence
At 2026-11-11 17:12:28 CET, heartbeat commits failed with
database or disk is full; all executor workers then hitdisk I/O errorand the executor restarted. A read-only check with this branch currently reports only 2.6 GiB / 0.9% available on the database filesystem, so host cleanup remains an urgent operational action. This PR adds the missing early warning; it does not reclaim disk space.Validation
pytest -q -p no:cacheprovider— 729 passedmonitor.database_filesystem_lowwith 2.6 GiB / 0.9% availableAddresses #343
Addresses #344
Addresses #345
Addresses #346