Skip to content

bug(health): one probe timing out under load makes the whole system read down, and code-analysis workers run at normal priority #20483

Open

Description

@mrveiss

Problem

On the local install at f88cd37, during a codebase analysis on 2026-11-01 around 12:50 Riga, GET /api/system/health read down and the backend felt slow. Read-only measurements:

Measure Result
Load 43.9 on 22 cores, 13 GB memory available
CPU by group (ps, sum of %CPU) development tooling on the same machine about 1440% (guards and hooks 1053, local pytest 390); backend and its children 388; other 344
Backend main process 25% CPU; /api/health answered in 43-131 ms over 6 calls, so its event loop was not stuck
/api/system/health 0.4-0.95 s and degraded over 6 calls; 3.1-4.8 s and down on earlier calls
The llc probe 258-632 ms over 6 calls, 1072 ms on another; one sample down with "probe timed out after 2.0s", latency 3751 ms
Children of the backend the analysis worker at nice 10, 204%; two code-analysis pool workers at nice 0, 86% and 73%, running about 16 minutes
Logs Duplicate detection timed out after 120.0s at 12:33, 12:40 and 12:45; api_endpoint_analysis was cancelled; /api/analytics/codebase/endpoint-analysis returned 504

What this shows

  1. down came from one probe. llc exceeded its 2 s budget while the machine was CPU-contended, and one timed-out probe makes the whole system read down. No service was found to be down in these samples.
  2. llc also reads degraded for its own reason, unrelated to load: agents_overdue_degraded: 1, and scheduler_last_tick_age_seconds is null.
  3. The pool workers run at normal priority, while indexing_worker.py lowers itself with os.nice(10). They compete with the server's own work.

Not known

  • What share of the slowness each source caused. Most CPU on this machine was development tooling, which a normal install does not have, so this run may overstate it. Nothing was stopped to compare.
  • Whether the pool workers were still doing the work of scans whose deadline had passed. The log warns "pooled work may still" run, and I did not sample their stacks.
  • Why llc needs 250-1000 ms when its docstring says well under 500 ms.

Acceptance criteria

  • Code-analysis pool workers run at the same lowered priority as the indexing worker (test).
  • A probe that only timed out does not make the whole system read down; it reads as unknown or degraded, and a probe that reports a real failure still reads down (test).
  • Host: during a codebase analysis, /api/system/health does not read down while /api/health answers normally, with output pasted here.

Activity

  1. added
    bugSomething isn't working
    phase:M1.4Wizard and SLM: choose a mode, apply it, default models work
    on Nov 1, 2026
  2. added
    needs-structureMissing goal milestone, matching phase label or native parent (#19522)
    on Nov 1, 2026
  3. github-actions commented on Nov 1, 2026

    @github-actions
    Contributor

    needs-structure cleared: goal milestone, matching phase label and native parent (or sub-issues) are all present (#19522).

  4. removed
    needs-structureMissing goal milestone, matching phase label or native parent (#19522)
    on Nov 1, 2026
  5. mrveiss commented on Nov 1, 2026

    @mrveiss
    OwnerAuthor

    Instance of the status-signal class on #20517. The fix stays here in #20494.

  6. github-actions commented on Nov 2, 2026

    @github-actions
    Contributor

    Landed via the merge train (#20598, merge 87eae8acf8) via #20494

  7. mrveiss commented on Nov 2, 2026

    @mrveiss
    OwnerAuthor

    Verified against origin/main after the merge train (PR #20598) landed (#20494 is a member).

    AC Evidence
    Code-analysis pool workers run at the lowered priority (test) autobot-backend/code_intelligence/shared/process_offload.py:82 os.nice(_WORKER_NICE) via the pool initializer (:132); process_offload_test.py:541 test_pool_workers_run_at_a_lowered_priority_and_the_backend_does_not (real spawned worker).
    A timeout-only probe reads degraded/unknown, a real failure still down (test) autobot-backend/api/system_health.py:148 detail "probe timed out after ...s"; system_health_timeout_20483_test.py: test_a_timeout_is_degraded_and_says_it_timed_out, test_a_real_failure_still_reads_down.
    Host: /api/system/health does not read down during an analysis, output pasted NOT MET. Needs a host run during a codebase analysis.

    Stays open for the host criterion, plus two unaddressed notes: why the llc probe takes 250-1000 ms, and whether workers keep running past a scan's deadline.

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

    backendbugSomething isn't workingphase:M1.4Wizard and SLM: choose a mode, apply it, default models workpriority: high

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions