Skip to content

tcpDest dials once and never reconnects — a receiver restart is a permanent blind #339

Done

Description

@randomizedcoder

Found by the red-team harness (findings.md harness row 20261114T085910, re-pinned by the Phase 4 premortem audit; docs/redteam-plan.md rows rt-4-7 / rt-11-5 measure it next).

Mechanism

pkg/xtcp/destinations_tcp.go: net.Dial at newTCPDest, and Send has no retry path — every subsequent envelope writes broken pipe forever after the receiver closes, even when the receiver is listening again. TCP-destination telemetry stays blind until a daemon restart. Counters do light up (destTCP/Write/error, Poller/envelopeFlush/error) but nothing repairs.

Measured

The harness hit this by restarting the catcher (the jsonl sink) mid-run: every subsequent envelope errored until the daemon was restarted.

Fix directions

  • reconnect with backoff on write error (bounded attempts, jitter), and/or
  • a destTCP/reconnect counter + a delivered-stale alert so the blind is paged, not just logged.

Scenarios

rt-4-7 (broker-outage recovery) and rt-11-5 (L2 delivery kill) measure the outage family; when a reconnect lands, their expectations flip in the same PR.

Activity

  1. added
    bug
    on Nov 25, 2026
  2. randomizedcoder commented on Nov 26, 2026

    @randomizedcoder
    OwnerAuthor

    Fixed by PR #348 (with the expectation flip on the row that pinned it): the tcp destination's worker now reconnects — a failed write closes the conn and the next attempt re-dials under full-jitter backoff (the cap derived like the s3 ladder), with a bounded attempt budget per envelope and a write deadline bounding each dial.

    Measured by rt-4-7 (BLOCKED 15/15, evidence 20261126T110001-209ab068a-1548426): with the catcher stopped, the outage is counted (destTCP Write/error=24, Dial/error=25, xtcp_tcp_dropped_total=9) and polling continues — and the catcher restart heals delivery with no daemon restart (reconnects=1, 2482 lines/6 s after return; the pre-fix run measured 0 lines/6 s with the catcher back until a daemon restart). rt-11-5's de-poison arcs confirm the same on the L2 blackhole variant.

    Startup also no longer aborts on a down sink: newTCPDest validates the address and leaves dialing to the worker, so the daemon starts with the sink unreachable and heals when it returns.

  3. randomizedcoder commented on Nov 27, 2026

    @randomizedcoder
    OwnerAuthor

    Correction: the fix landed in PR #352 (not #348 as referenced above — that number went to an unrelated PR in the meantime). The branch is redteam/tcp-dest-queue-worker, commit 55f387519.

  4. added a commit that references this issue on Nov 27, 2026
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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions