Skip to content

SendTracing allocates repeatedly above 64 overlapping sends #131

Closed

Description

@thomhurst

The shared SendTracing pool has a fixed retention capacity of 64 states (src/Relayer/Telemetry/SendTracing.cs:26, Rent at 173 and Return at 183). Rent allocates a new State when all slots are busy; Return drops a state when every slot is full. A steady workload with more than 64 overlapping traced sends therefore allocates State objects and their arrays on every burst, even after warm-up. This is Relayer-owned state, separate from the Activity allocations allowed by the telemetry contract.

Reproduction:

  1. Enable an ActivityListener for an isolated MessageTracing.Source.
  2. Construct SendTracing with a deterministic send delegate held behind a completion gate.
  3. Start 128 overlapping sends, release the gate, and await all sends.
  4. Repeat after warm-up and measure allocations. Only 64 states can be retained for the next burst.

Expected: retain the observed concurrency high-water mark without introducing per-message locks, or use another measured allocation-free design. The existing segmented pools in SendRoute and SenderPool provide a local pattern; the Kafka producer implementation in #125 also follows that pattern.

Acceptance criteria:

  • Add deterministic coverage with more than 64 overlapping single and batch sends; verify warm-up eliminates Relayer state allocations and that states remain exclusively owned until completion.
  • Preserve creation headers, cancellation, native partial failures, span links and concurrent provider isolation.
  • Add or extend a MemoryDiagnoser benchmark because the pool algorithm changes per-message work.
  • Keep user documentation current if observable guarantees change.

Activity

  1. added
    P2
    in-progress
    on Nov 1, 2026
  2. thomhurst commented on Nov 1, 2026

    @thomhurst
    OwnerAuthor

    Recorded #143 as the native prerequisite for #131's PR #148. The earlier Performance run 41351870604 has finished; its missing-harness failure was fixed by rebasing #148 to current main. Claude and Codex both approve current head 2b519c0.

    The remaining required-CI failure is the Testcontainers resource-reaper collision tracked by #143 and fixed by #149. Blocker-first handoff attempted to acquire pr-149, but another worker holds it. No additional blocker comment was added to #148, whose latest loop comment already records this condition. After #149 lands, incorporate its fix into #148 and repeat current-head draft review before ready CI.

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

    P2in-progress

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions