Skip to content

pm-projector /health stalls >=90s under load - sentinel down alerts fire while the process never restarts #9850

Open

Description

@dezren39

Fleet downtime investigation, 2026-11-14 (Drew: "fix why website keep go down").

Evidence

The PM stack-health sentinel (pm-stack/aggregator/scripts/stack-sentinel.ts) probes the projector at http://127.0.0.1:7801/health with a 10s timeout and declares down after 3 consecutive failed probes (PR #9053 damping, merged 2026-11-12). That config is verified correct in the running tree - the flapping is NOT a probe-config problem anymore.

Down-episode counts from ~/.local/state/pm-aggregator/notifications.jsonl (stack-health, service:projector, episode = one recovered transition):

  • 2026-11-11: 46 episodes
  • 2026-11-12: 60 episodes
  • 2026-11-13: 17 episodes
  • 2026-11-14: 5 episodes by 08:39Z (incl. 06:38Z and 07:37Z, each recovering in ~2-4 min)

Meanwhile the projector process itself never restarts: pm-projector.service has run as a single PID (2121) since 2026-11-13 19:29 CST, 578MB memory, ~6m39s CPU in 7h, no restarts in today's journal. So /health stops answering for >=90s windows while the process stays alive - an event-loop stall or a hung await inside the projector (its GitHub projection sync is the prime suspect: a long sync or an unbounded fetch with no timeout would block exactly like this), most frequent when the laptop is loaded (load1 observed 8.58 with ~60 fleet jobs).

User impact today is alert noise + stale board data (the aggregator serves the pages; service:aggregator recorded exactly 1 down in 3 days). But a health endpoint that stalls for minutes is also how a real projector death would hide, and this is the single largest source of stack-health alerts in the fleet.

Acceptance

  • Root cause of the /health stalls named with evidence (e.g. stall windows correlated with projection sync cycles in the projector's own logs).
  • 7 consecutive days with zero stack-health 'sent' notifications for service:projector, OR every declared down backed by a journal-verified real failure.
  • A regression guard: the stall mechanism (sync blocking the health path) covered by a test or by a heartbeat/watchdog that makes a stall self-evident in logs.

Activity

  1. added
    queue/queued
    on Nov 14, 2026
  2. developing-today commented on Nov 14, 2026

    @developing-today
    Contributor
  3. added
    work/assigned
    queue/claimed
    status/in-progress
    and removed
    queue/queued
    on Nov 14, 2026
  4. dezren39 commented on Nov 14, 2026

    @dezren39
    MemberAuthor

    Root cause named, with evidence — and the fix (lane code-c, queue task 16547, 2026-11-14)

    Evidence

    • Live reproduction during diagnosis (2026-11-14 ~15:0xZ, while a reconcile pass was running): three consecutive /health probes hit the 15s curl cap (no response at all), the fourth took 5.14s, then 1.6ms / 1.7ms once the burst drained. The process never restarted — the health path itself stalls in bursts.
    • Reconcile pass durations today (journal, pm-projector-reconcile.service): 76 min, 58 min, 2h34m, 43 min — against a 15-minute timer, so passes overlap the entire day. The sentinel's down episodes cluster exactly in this regime.
    • Code facts: every request handler and the reconcile trigger shared one libSQL Client (serve(db) → handleRequest(req, db, …) → reconcileRepos(db, …)), and /health itself awaited a COUNT(*) query on that client. The reconcile streams wrote one awaited round trip per row (upsertItem = one batch per row, upsertComment = one execute per row), and the two comment streams ignored their stored cursor and re-pulled and re-wrote each repo's entire comment history every pass ("These endpoints do not support since" — they do). Four repos × five streams of that, over a remote libSQL connection, is a write flood measured in hours; the client's serialized requests queue /health behind it. GitHub fetches additionally carried no timeout, so a hung response wedged a pass indefinitely.

    The fix (PR incoming, this task)

    • /health gets a dedicated DB client in production wiring (index.ts opens separate clients for health and for the reconcile trigger), and its probe is bounded at 5s — a late health answer is a down answer, never a queued one. Response shape unchanged (the sentinel only needs the 200; the counts still ride along).
    • Reconcile writes are batched: each row's own statements (unchanged, in order, per-row atomicity preserved) are flattened into chunked write batches — a few round trips per stream instead of one per row.
    • Comment streams now send since=<cursor> — steady-state passes are incremental; only a first pass pulls the full list.
    • Every GitHub fetch carries a 30s AbortSignal timeout (and 10s for the freshness publisher).
    • Regression guard: test/health-isolation.test.ts pins the mechanism — while a slow write flood is still running on the main client, /health through its dedicated client answers promptly (asserts the flood has not finished when the answer arrives). Per-stream reconcile timing lines now land in the journal, so a future stall is self-evident in the projector's own logs instead of only in sentinel noise.

    Verification: full projector suite 137 pass / 0 fail (incl. the new guard and the existing reconcile/store/e2e suites); tsc --noEmit shows no new errors (the serve-handler and webhook-delivery-id errors are pre-existing on main, verified against a clean main worktree).

    What remains after merge

    • Deploy: the PM services run from ~/git/code, kept on main by pm-git-sync — which is currently refusing to pull because that checkout is on another lane's live branch (queue/12607-2319-gateway-envelope, pm-git-sync FAIL lines in today's journal). The merge lands the fix on main; the live service picks it up through the normal git-sync route once the checkout returns to main. I am not disturbing another lane's branch to force it.
    • Acceptance Bump checkmarx/ast-github-action from 2.0.11 to 2.0.18 #2 (7 consecutive days, zero projector notifications) starts counting only once the fix is live; a dated follow-up will verify the soak against notifications.jsonl and close out this issue. This issue stays open until then — the fix is necessary but the soak is the criterion.
  5. added a commit that references this issue on Nov 14, 2026
  6. dezren39 commented on Nov 14, 2026

    @dezren39
    MemberAuthor

    Picked up by repo-worker-code-b — working this now. (Fleet queue fallback mode: the queue backend is down, so this issue's comments carry the claim. The claim stays live while repo-worker-code-b posts progress markers; after 30 minutes of silence any other worker may pick this up.)

  7. dezren39 commented on Nov 14, 2026

    @dezren39
    MemberAuthor

    Released by repo-worker-code-b (outcome: done). Already done by lane code-c (queue task 16547): root cause named with live-reproduction evidence and fix posted 2026-11-14T15:19Z; issue #9850 CLOSED with status:done before this lane's claim landed. No duplicate work performed.

  8. 47 remaining items

  9. added
    epic/pm-stack
    primary-parent/pm-stack
    stray-work
    stray/needs-parent
    and removed
    epic/pm-stack
    primary-parent/pm-stack
    on Nov 27, 2026
  10. added
    priority/normal
    on Nov 29, 2026
  11. developing-today-fleet commented on Nov 29, 2026

    @developing-today-fleet
    Contributor

    🤖 Census note — 2026-11-29 (lane CEN-C09, full issue census)

    State verified today: the fix is deployed (d483f3f is an ancestor of main) and the projector has been healthy at every soak re-check: pm-projector.service active since 2026-11-26 03:38 CST with 0 restarts, /health answering in <1ms at check time, and the soak oracle — ~/.local/state/pm-aggregator/notifications.jsonl — unchanged since 2026-11-16 (no new projector down-episodes).
    What remains: the soak itself. The long reconcile passes (3-7 min, individual streams ~100s) are the residual stall risk the soak is watching; this issue closes when the contracted soak window completes with no new down-episode rows.
    Blocker: time, not work — no lane action is pending.
    Census fixes: added missing priority/normal.
    Verdict: blocked — parked soak; evidence trail is complete for whoever verifies the close.

  12. added
    priority/high
    on Nov 29, 2026
  13. developing-today-fleet commented on Nov 29, 2026

    @developing-today-fleet
    Contributor

    Census 2026-11-29 (Felix): full recheck of this issue — details, labels, blockers, priority (rechecked from scratch; prior detail did not exempt it).

    STRENGTHS:

    GAPS FOUND:

    • no kind label (kind not unambiguous from title/body — left for the picking-up lane to set)

    FIXES I APPLIED:

    • none needed

    REMAINS: nothing — ready for pickup

  14. removed
    priority/high
    on Nov 29, 2026
  15. developing-today-fleet commented on Nov 29, 2026

    @developing-today-fleet
    Contributor

    Priority validation 2026-11-29 (Felix): priority/high + priority/normal → priority/normal — the fix is deployed (d483f3f on main) and the projector has been healthy at every soak re-check since 2026-11-26 with 0 restarts; the remainder is soak observation, so the incident band (high) comes off and normal stands

  16. added
    kind/bug
    on Nov 29, 2026
  17. developing-today-fleet commented on Nov 29, 2026

    @developing-today-fleet
    Contributor

    Issue census — 2026-11-29 (wave 2 residual pass)

    This issue already carries full census notes from parallel lanes today (CEN-C08/C09 and a Felix seat). I skimmed those notes, re-verified the live state, labels, and body firsthand, and do not duplicate their verdicts — this note records only my residual check and anything I changed.

    Residual check: kind/* missing — a defect report with evidence, kind/bug added. Acceptance present inline in the body (## Acceptance). State per CEN-C09: fix deployed, projector healthy since 2026-11-26, remainder is the soak window — blocker is time, recorded. Snapshot near-empty labels already repaired (priority/normal added by CEN-C09).

    Actions taken by this pass: labels added: kind/bug.

    Priority: priority/normal — stands; no band change by this pass.

  18. developing-today-fleet commented on Nov 30, 2026

    @developing-today-fleet
    Contributor

    Criterion-by-criterion disposition — lane 0900-AF (Xaltha, kind/bug premise-check sweep), 2026-11-30. Two of three acceptance criteria verified firsthand this lane; the third rests on named laptop reads and needs exactly one more firsthand laptop read to close. Issue stays open (status/parked is correct) — this note pins the single remaining check so no future lane re-derives it.

    • Criterion 1 (root cause named with evidence): DONE. Recorded 2026-11-14 (lane code-c): live stall reproduction during a reconcile pass; mechanism = reconcile write flood / sync blocking the health path.
    • Criterion 3 (regression guard): DONE — verified firsthand this lane from the merged diffs. PR pm-projector: stop the reconcile write flood from stalling /health (#9850) #10084 (merged 2026-11-14, merge d483f3fe) introduced pm-stack/projector/test/health-isolation.test.ts alongside the reconcile/server fix; PR fix(pm-stack): health snapshot, incremental reconcile streams, single-flight, cached attention (#9850) #10466 (merged 2026-11-15, merge 3a0eca50) extended that same health-isolation suite (+57) and test/reconcile.test.ts (+68) with the health path isolated from reconcile (projector src/server.ts +100/−11). The stall mechanism is test-covered on current main.
    • Criterion 2 (7 consecutive days, zero stack-health sent notifications for service:projector): EVIDENCED, not firsthand-verifiable from this seat today. The oracle is a laptop-local file (~/.local/state/pm-aggregator/notifications.jsonl on amd-6, off the tailnet; this seat's shell leg is down). Named reads on record: 2026-11-26 soak re-check — file unchanged since 2026-11-17T02:01:46Z, projector active since 2026-11-26T03:38:41Z with 0 restarts, /health HTTP 200 in <1 ms; CEN-C09 2026-11-29 — concurs, no new projector down-episodes. If those reads hold, the 7-day window has been satisfied many times over (2026-11-17 → 2026-11-30 is 13 days).

    Wake (machine-checkable, single step): any lane with a laptop route reads notifications.jsonl on amd-6 and confirms (a) no stack-health sent row for service:projector in the trailing 7 days and (b) pm-projector.service still active with 0 restarts since 2026-11-26 — then close #9850 as completed citing criterion 1 (2026-11-14 record), criterion 3 (PRs #10084/#10466, verified above), and that read. If a projector sent row exists in the window, the soak restarts from that row's date — do not close.

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

    kind/bugpriority/normalqueue/parkedstatus/parkedstray-workstray/needs-parent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions