Skip to content

proxy: a multi-second node-local stall at the parent's 'closing and draining listeners' during some hot-restart handoffs (1 liveness timeout in the 2026-10-01 soak, not #1085) #1093

Closed

Description

@bpalermo

Soak csi-039/2.0.0-75caf0f (T0 2026-10-01T00:40:30Z): the only liveness miss was ONE 2 s probe timeout on main-worker-04 at 02:16:49.443Z (Get http://127.0.0.1:18081/-/-/live: context deadline exceeded, elapsed 2004 ms), i.e. the hard liveness bar failed by 1 / 719,988.

Mechanism (from the access logs + supervisor timeline), seen on 3 of 30 handoffs — w04 in proxy rolls #2 (02:16) and #3 (04:17), w05 in the TRIPLE (05:41):

Not measured: node CPU during the stalls (Pyroscope/process CPU of the two epochs would tell whether the parent's drain or the child's warm-up saturates the node). Closest existing issue is #1040 (mesh_dns timeout bursts at proxy rolls, unattributed) — this may be the same mechanism with the liveness tier finally catching it. Grade: session scratchpad soak-csi-039/GRADE.md; memory project_soak_20261001_csi039_run.md.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

Activity

  1. bpalermo commented on Oct 1, 2026

    @bpalermo
    OwnerAuthor

    First sampler data (2026-10-01, main fe006e5 with #1100, short e2e under k6 load, 16:57Z→)

    Classification so far: starved — Envoy worker threads waiting in the run queue on a CPU-saturated node. Not blocked, not busy.

    • Stall lines in the first ~20 min of load, per node: w05 252, w04 139, w02 92, w01 18, w03 2 — the same w04/w05 skew as the soak.
    • Typical line: wrk:worker_0[starved] cpu=219ms runq=253ms blocked=0ms ×4 workers, with nodeBusyPct 70–92, nodePSICPUSomeMs 465–848 per second, hottest CPU irq+softirq 14–26%, steal 0.
    • The proxy container has no CPU limit (requests 500m, Burstable), so this is not CFS throttling by its own quota; it is contention. Nodes are 4-core; under k6 load the proxy uses 0.8–0.9 core while its cgroup weight (500m of ~3.1 cores requested on w04) entitles it to roughly 0.65 core when the node saturates — the workers get about as much run-queue wait as CPU.
    • Biggest co-tenants by usage: pyroscope (0.39 core, on w05), otel-collector (0.24, on w04), democratic-csi node (0.18), k6 loader (0.16), plus the test services.

    Working hypothesis: a handoff adds a second Envoy (child warm-up + parent drain) on an already saturated node and tips the starvation from ~25% to multi-second.

    Next: (1) read the stall lines inside the three proxy-roll brackets of this e2e; (2) A/B a higher proxy CPU request on talos (500m → 900m is the most that still lets the surge pod schedule on w04) and compare stall-line counts per node under the same e2e load; (3) if that works, decide the chart default and whether the co-tenants should move (GitOps side).

    🤖 Generated with Claude Code

    https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

  2. bpalermo commented on Oct 1, 2026

    @bpalermo
    OwnerAuthor

    A/B: proxy CPU request 500m → 800m (2026-10-01, same build fe006e5, same short e2e: agent roll + 3 proxy rolls under k6)

    Stall lines (envoy thread stall, all class starved) in T0→T0+35 min:

    node 500m (T0 16:57:05Z) 800m (T0 17:48:13Z) change
    main-worker-05 705 594 −16%
    main-worker-04 426 366 −14%
    main-worker-02 360 325 −10%
    main-worker-01 38 18 −53%
    main-worker-03 1 4 —

    Prober during both runs: 0 failures (liveness and mesh_dns success only; no failure series exists since the 16:57Z prober restart). k6: 1 / 792k and 0 / 792k.

    Reading: more cgroup weight helps a little but does not remove the starvation — the nodes are saturated (70–92% busy on 4 cores), so shifting share only moves wait around. 800m is kept on talos for tonight's soak (it fits: ~93% of w04 requested during a roll with the surge pod), but it is not the fix.

    Candidates for the real fix, in the order I would test them:

    1. The handoff's own CPU burst. The soak's failures start at the parent's closing and draining listeners: every peer re-establishes its connections to the new epoch at once, and each is an mTLS/QUIC handshake with a client certificate (no resumption by design, R4). Measure handshake rate and CPU for the 10 s after the drain line on w04; if that is the spike, stretch the listener drain ramp so reconnects spread over the drain time instead of landing in one burst.
    2. Co-tenant placement on the two hot nodes (pyroscope ~0.4 core on w05, otel-collector ~0.25 on w04, both latency-insensitive) — a GitOps-side change, owner's call.
    3. Envoy --concurrency below the core count on 4-core nodes, to stop four workers competing with everything else for four cores.

    Tonight's soak (T0 ≈ 02:00Z) will give the stall lines inside real handoff brackets with prober failures, which is the data candidate 1 needs.

    🤖 Generated with Claude Code

    https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

  3. bpalermo commented on Oct 1, 2026

    @bpalermo
    OwnerAuthor

    Handoff-bracket analysis of three runs (2026-10-01) — the drain ramp is not the lever

    Runs: A = 500m request, 10 s drain; B = 800m, 10 s; C = 800m, 30 s drain / 35 s parent shutdown. Same build, same short e2e (agent roll + 3 proxy rolls under k6). Metric: starved ms (sum of runq= over threads and flagged seconds) in [drain line − 5 s, parent exit + 5 s], medians of 3 rolls on the nodes that stall.

    A B C
    starved ms per bracket, w02 / w04 / w05 32k / 37k / 43k 21k / 23k / 49k 27k / 38k / 48k
    flagged seconds per bracket 17 / 15 / 20 13 / 18 / 21 19 / 26 / 33
    max single-thread runq in one second (ms) 741 / 761 / 805 731 / 750 / 917 693 / 770 / 842

    Roll-to-roll noise is about ±50%, so differences under ~30% are not significant.

    Findings:

    • The stall is already at full height while the successor is still initialising, before the parent drains: 1,950–2,640 starved ms/s from fork to the drain line vs 1,200–2,240 in the 10 s after it, both 6–14× steady. It starts rising in the 5 s before the fork, while the surge pod starts.
    • Parent and child starve about equally (40–61% parent); blocked ≈ 0; nodeBusyPct goes from 81–85% to 88–95%; softirq share is unchanged. It is plain CPU oversubscription: a second Envoy (4 workers + main) on a 4-core node that is already saturated.
    • Not the handshake burst: the rolled node opens 280–510 new connections in 15 s vs ~100 steady — ≤ 0.8 CPU-s, against 10–13 CPU-s of extra Envoy CPU per handoff; the flame graph during the handoff has the steady-state shape (I/O path), no handshake or config-parsing frames.
    • 30 s ramp (C): no lower peak, more flagged seconds per handoff (19–33 vs 13–21), more Envoy CPU per handoff (14–19 vs ~10–13 CPU-s), rolls 70% longer, and 5 Sending Stateless Reset lines vs 2/0 (no failed request). Reverted to 10 s / 15 s.
    • 800m (B): steady starvation on w04/w05 −26–35%, handoff within noise. Kept.

    Next lever: Envoy --concurrency 2–3 instead of the core count on these 4-core nodes — during a handoff 8 worker threads + 2 main threads share 4 saturated cores. Needs a chart knob (in progress), then the same A/B. After that, co-tenant placement (pyroscope ~0.4 core on w05, otel-collector ~0.25 on w04 ≈ the 0.5 core a handoff needs) — GitOps side, owner's call.

    Full tables: session scratchpad analysis-1093.md.

    🤖 Generated with Claude Code

    https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

  4. bpalermo commented on Oct 1, 2026

    @bpalermo
    OwnerAuthor

    Two workers vs four (runs D and E, 2026-10-01, tonight's main 231498f, 800m, 10 s drain)

    per node w02 / w04 / w05, median of 3 rolls D: --concurrency 2 E: default (4) change
    starved ms per handoff bracket 5.0k / 13.0k / 13.2k 20.8k / 26.7k / 37.8k −63%
    same, per worker thread (the fair comparison) 2.5k / 6.5k / 6.6k 5.2k / 6.7k / 9.4k −27%
    flagged seconds per bracket 6 / 13 / 14 11 / 17 / 19 −25 to −45%
    max single-thread runq in one second (ms) 584 / 494 / 593 600 / 718 / 733 up to −31%
    steady starved ms/min 989 / 2,552 / 3,421 5,205 / 5,889 / 10,779 −57 to −81%
    Envoy CPU, steady (cores) 0.84 / 0.80 / 0.80 0.74 / 0.79 / 0.98 same

    First lever that moves the handoff stall by more than the roll-to-roll noise, with no cost inside the 2→2 brackets (DC ratio equal, stateless-reset lines 1 vs 2, k6 0 failures across the three 2→2 rolls). A handoff still costs 13–14 flagged seconds on w04/w05, so it reduces rather than removes the stall.

    It cannot be rolled out yet: the 4→2 transition crashes the successor (#1126) and then trips a supervisor bug (#1127). Path: fix those two, switch talos to 2 workers with the next deploy, then soak. Tonight's soak runs the default 4 workers.

    Summary of today on this issue: CPU request 500m→800m = small steady gain, kept; drain ramp 10 s→30 s = worse, reverted; handshake burst = not the cause; 2 workers = real gain, blocked on #1126/#1127; co-tenant placement (pyroscope, otel-collector) = untested, owner's call.

    🤖 Generated with Claude Code

    https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

  5. bpalermo commented on Oct 2, 2026

    @bpalermo
    OwnerAuthor

    Soak 2026-10-02 (main 231498f, chart 2.2.0, T0 01:53:09Z): the stall sampler pins it

    The run's only gate miss was liveness: 4 timeouts / 719,979, in exactly the two hot-restart handoffs with the highest starvation of the whole run. Everything else passed, k6 was 0 / 9,179,946.

    episode node / roll liveness mesh_dns what the sampler shows in ±10 s
    A 05:31:17–21Z w04, proxy roll #3 (child forked 05:31:08.65, workers 13.31, parent drain 13.74, exit 28.85) 1 timeout at 05:31:19.29 22, all to echo on w04 every line [starved]; all 4 workers + main waited 524–882 ms of each second (~3.7 s summed per second); node 98.8–100% busy, PSI 930–1064 ms/s; parent and child starve together
    B 06:54:21–26Z w05, TRIPLE (child forked 06:54:12.35, workers 17.04, parent drain 17.70, exit 32.54; the node's agent restarted inside it) 3 timeouts at 23.55 / 23.75 / 24.19 47 child flagged every second; worst second of the run 06:54:22.94: worker_1 waited 961 ms, sum 4,364 ms, busy 99.5%, PSI 1061

    Starved ms per handoff bracket [drain − 5 s, parent exit + 5 s]:

    node roll 1 roll 2 roll 3 roll 4 TRIPLE roll 6 median
    w01 3,563 5,287 2,267 454 3,347 2,699 3.0k
    w02 29,124 21,169 16,321 15,652 28,193 24,378 22.8k
    w03 6,526 8,775 11,951 10,362 9,855 3,931 9.3k
    w04 41,755 36,790 54,804 18,996 29,410 35,008 35.9k
    w05 22,383 17,858 23,791 30,092 85,914 38,102 26.9k

    The two failures are the two largest brackets; nothing at or below 41.8k failed. Parent/child split in the failing brackets 48/52 and 44/56; 0 blocked-class lines in the run.

    Steady state in the 87-min no-roll window (starved ms/min): w01 139, w02 3,821, w03 378, w04 17,407, w05 3,978. w04 is ~3× what it was on 10-01: test pods have drifted onto it and its proxy burns +24% CPU.

    Conclusion: a threshold effect of CPU oversubscription while two Envoys overlap on a 4-core node. Ordered next steps:

    1. Fix proxy: Envoy segfaults in HotRestartingChild::onForwardedUdpPacket when the successor has fewer workers than the parent (4→2 hot restart, 'Mismatched worker index') #1126 and supervisor: the old pod's self-drain calls the Envoy admin on 127.0.0.1:9901 without checking it is its own Envoy — it drained the NEW pod's freshly started Envoy, which then served no new listeners #1127, then run 2 Envoy workers (10-01 runs D/E: starved ms per bracket −63%, per thread −27%, steady −57 to −81%).
    2. Rebalance: w04's steady load, and pyroscope/otel-collector on w05/w04 (GitOps side).
    3. Keep the TRIPLE from stacking an agent restart on a proxy handoff on the same node, or accept it as the harness's worst case.

    🤖 Generated with Claude Code

    https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

  6. bpalermo commented on Oct 2, 2026

    @bpalermo
    OwnerAuthor

    Folded in from #1128 (closed as a symptom of this issue): during the two starved brackets of the 2026-10-02 soak the destination proxies logged 111 × 503 UF connection_timeout to the local app (w04 37, w05 74), all retried by the source. Sizing question to settle here once 2 workers are deployed: the app connect timeout is 1 s (#1122, needed so a terminating pod's 503 still leaves before its veth goes), which equals Linux's initial SYN retransmit — one dropped SYN on a starved node can never be recovered inside it. If starved brackets persist after the worker change, consider 1.5 s with the CNI DEL hold raised to 3 s; if they disappear, leave it.

  7. bpalermo commented on Oct 2, 2026

    @bpalermo
    OwnerAuthor

    Correction to the 2026-10-02 soak comment above: "0 blocked-class lines" is wrong. Over the 8 h window there were 12,997 stall lines: 12,965 starved, 31 blocked (w02 8, w05 8, w04 6, w03 6, w01 3) and 1 busy. 30 of the 31 are the Envoy main thread waiting ~240 ms in __futex_wait right at a handoff (e.g. w04 05:31:14.06, between the child's starting workers 13.31 and the parent's drain 13.74) — about one per node per handoff (30 handoffs). That is a short lock wait during worker start, an order of magnitude below the multi-second starvation, and it does not change the conclusion; recorded so the class counts are right.

    Query note (LogsQL): these supervisor records are not field-parsed, so select a class with the bracketed phrase on the message, e.g. "envoy thread stall" "[blocked]"; threads:starved matches nothing and the bare word blocked matches every line (blocked=0ms).

    🤖 Generated with Claude Code

    https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

  8. bpalermo commented on Oct 2, 2026

    @bpalermo
    OwnerAuthor

    Two workers are live on talos since 2026-10-02 19:03Z (chart 2.2.3, proxy.concurrency=2; #1126/#1127 fixed). First like-for-like reading, short e2e (agent roll + 3 proxy rolls under k6), stall lines in T0→T0+35 min:

    node 4 workers (10-02 01:00Z, main 231498f) 2 workers (10-02 19:03Z, main 222af5d)
    w05 518 130
    w04 310 165
    w02 311 192
    w03 3 55
    w01 29 28
    total 1,171 570

    Prober during the 2-worker e2e: 0 failures in either tier across all four rolls; k6 0 failures. (Line counts are coarse — a 2-worker line carries fewer threads — the bracket metric comes with tonight's soak, T0 ≈ 01:50Z 10-03.)

    🤖 Generated with Claude Code

    https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

  9. bpalermo commented on Oct 3, 2026

    @bpalermo
    OwnerAuthor

    Nightly soak 2026-10-03 (nightly-1003/2.2.3-222af5d: proxy.concurrency: 2, proxy CPU request 800m, drain 10s/15s) vs 2026-10-02 (nightly-1002/2.2.0-231498f: 4 workers, otherwise the same harness — 30 proxy handoffs each, same churn script, same k6 load):

    10-02 (4 workers) 10-03 (2 workers)
    prober liveness failures 4 0 / 719,974 (raw counters at T0 and T0+8h; no result!="success" liveness series existed at any point in the window)
    per-handoff stall bracket, max (Σ starved runq ms over [parent drain −5s, parent exit +5s]) 85,914 27,788
    bracket median / p90 18.4k / 38.1k 7.3k / 20.2k
    fleet sum over 30 brackets 639k 262k (−59 %)
    brackets above 41.8k (the level above which 10-02's two failures sat) 2 0
    destination-side 503 UF connection_timeout on loopback 111 0
    Mismatched worker index / initial fetch timed out 0 / 1 0 / 0
    k6 0 / 9.18M 0 / 9,179,938

    Steady-state (no roll) starvation, ms/min: w02 3,821 → 1,035, w04 17,407 → 3,851, w05 3,978 → 3,092; w01/w03 unchanged.

    What did not change: the per-thread peak runq (961 → 891 ms/s) and node busy at the bracket peak (still 99.4–100 %, PSI ~1,000 ms/s). Two workers mean fewer threads waiting in the run queue during the two-Envoy overlap, not a node that stops saturating — the margin comes from the stall being spread over fewer threads, so the prober's 2 s budget is no longer exceeded.

    Residual, outside this issue's gate: 14 mesh_dns timeouts (0.001 %; 0 dns_*), all on w05 at 06:53:35–38Z inside the run's largest bracket (the TRIPLE step, 27.8k). There the agent restart overlapped the tail of the proxy handoff: ADS was down from ~06:53:33.4 and the new agent logged first at 06:53:39.3. That is #1123's window (agent restart → stale xDS) landing on a node mid-handoff; noted there.

    Closing: the acceptance criterion (0 liveness failures at hot-restart handoffs over the 8 h soak) is met, with the worst bracket a third of the previous worst and below the best non-failing 10-02 bracket. One run, so a second nightly will confirm; if a liveness failure recurs with 2 workers, the next levers (co-tenant placement on w04/w05, realistic CPU requests on the test pods, node headroom per the runbook's "Sizing nodes for a proxy hot restart") are on the table and this reopens.

    Grading method and queries: raw-counter deltas per series (never a bare increase() over a series born inside the window), stall sampler lines from VictoriaLogs filtered by the bracketed class phrase, bracket script unchanged from 10-02 except the parser now accepts the combined [starved,blocked] class this build emits.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions