Skip to content

c2c stalls ~10s via codex during host IO waves (fsync-heavy hook path, idle pi-c2c snapshot churn, stale broker debris) #90

Description

@XertroV

Symptom: c2c invocations from codex visibly take ~10s. Reproduced independently: a repo .mcp.json c2c MCP server missed its 30s client startup timeout at ~02:40 AEST while the same handshake later completed in 0.95s.

Root cause: bursty host-wide IO saturation. Measured in one window: PSI io some 18-21% sustained, full 6-9%; nvme0n1p5 at ~1.0s average latency per I/O (only ~3MB/s throughput — latency-bound, not bandwidth-bound); btrfs flush kworkers in D-state; find ~/.c2c/repos 4.9s. Codex runs c2c hook codex on UserPromptSubmit + PostToolUse + SessionStart + SessionEnd with timeout = 10, and the hook path does several atomic (fsync) writes + registry reads + cross-broker alias scan — so a wave multiplies into the full 10s budget per prompt and per tool call.

c2c itself is fast when the disk is calm (all measured this session): whoami ~25ms, hook codex 172-572ms real broker / 97ms hermetic, MCP handshake 0.95s.

Contributors measured during waves

  • kitty scrollback writes ~2.2MB/s (TUI output churn from many agent panes — hermes ×3, codex ×2, claude, pi, chromium)
  • pi-c2c idle snapshot churn: idle Pi session in ~/src/amaroo (c2c oc-plugin stream-write-statefiles, v0.14.4) writes ~37KB every ~5s ≈ 26MB/h of fsync fan-out, 63MB in its first 16 min, with zero activity
  • connector-state sweep: 161/229 ~/.c2c/repos/*/broker/connector-state.json written within 30 min (writer unidentified — long-lived c2c daemons had near-zero cumulative writes)

c2c-side aggravators / housekeeping debt

  • stale untracked repo .mcp.json ("tmp-restore-hook", Jul 19) pointed every MCP client at a dead /tmp broker → 30s timeouts + ghost alias; moved aside this session (.mcp.json.stale-tmp-restore-hook.bak)
  • 229 dirs in ~/.c2c/repos/ walked by the B188/B191 cross-broker scan on every auto-register
  • ~/.c2c/locks/ ≈ 20k+ session-reg-*.lock files (1.1MB dirents) since July, never pruned
  • stale kimi notifier daemon (3.5d old, cwd = deleted worktree); prior notifier log hit 52MB

Proposed follow-ups

  1. Prune ~/.c2c/repos test/worktree debris + stale session-reg-*.lock files (add a c2c dev housekeeping command or extend c2c dev instances clean-stale scope).
  2. pi-c2c: gate/throttle stream-write-statefiles fan-out when the session is idle (skip no-change snapshots); rebuild the pi extension against current c2c (it runs 0.14.4).
  3. Hook fast-path: when the session is already registered locally, skip the cross-broker alias scan; consider PSI-aware backoff so a wave does not burn the whole 10s hook budget on registry writes.
  4. Identify the connector-state sweep writer; make it incremental (skip unchanged brokers).
  5. c2c doctor: add an IO-pressure check (PSI) so "slow c2c" triage starts with the host, not the binary.

Full evidence + timings: .collab/findings/2026-09-02T16-55-00Z-grok-c2c-10s-stalls-host-io-waves.md

Activity

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