Skip to content

Attribute extra 56 B in buffered batch allocation comparison #585

Closed

Description

@thomhurst

The exact native-versus-pipeline comparison in BatchPipelineTests.Warmed_batches_add_no_allocations_beyond_identical_fresh_DI_scope_and_sender(True) failed on Linux x64 with 312,056 B measured against a 312,000 B native baseline. The test should measure equal allocations; the unexplained extra 56 B blocks confidence in this comparison even though the PostgreSQL inbox fix being tested is unrelated.

Reproduction

Original ready-PR CI run 43383708766 failed at commit d179ca1, tests/Relayer.Tests/BatchPipelineTests.cs:578.

Run dotnet test -c Release --project tests/Relayer.Tests -f net10.0 --treenode-filter "/*/*/BatchPipelineTests/Warmed_batches_add_no_allocations_beyond_identical_fresh_DI_scope_and_sender". The historical failure happened during parallel full-project CI; a narrow run may not reproduce it.

Investigation and remaining work

A bounded hosted diagnostic run 43386487904 at b3b0e29 retained all eight predeclared original/callback process pairs. All 16 processes passed. Each callback report recorded the expected 308,000 B in DI scopes/dictionaries/arrays plus a 32 B TUnit starvation-monitor work item on another thread (308,032 B total, zero profiler failures). This does not attribute the historical 56 B window: callback instrumentation changes fast paths and scheduling, includes all threads and provides no stacks. Passing trials do not replace the failed CI result.

The temporary diagnostic source and workflow remain available in that commit and in the uploaded 90-day artifact batch-allocation-43386487904-1 (artifact 14019285416). Its 2,010 manifest entries were downloaded and independently SHA-256 verified. Local retained evidence location will be added after issue creation. The instrumentation is removed from #571 following its scope review; no permanent hosted workflow is required merely to keep completed evidence.

Attribute the extra 56 B with a captured failing measurement or a deterministic reproduction, then correct its cause. Keep exact equality and parallel execution; do not add tolerance, retry for green, or process throttles. Search/reuse the existing native allocation profiler and measurement helpers. #299/#348 establishes a separate counter-only 40 B mechanism and does not establish the cause here.

Environment

Ubuntu 24.04 Linux x64, .NET 10 target, pinned SDK 11.0.100 (also installs 10.0.403); exact original runner logs are retained. No production API or behavior change is involved.

Activity

  1. added
    phase-0: core
    area: testing
    P2
    on Nov 13, 2026
  2. thomhurst commented on Nov 13, 2026

    @thomhurst
    OwnerAuthor

    Retained local evidence: /Users/tom/git/Relayer-evidence/issue-585/hosted-43386487904/batch-allocation-43386487904-1/. All 2,010 manifest entries were independently rehashed after copying from the downloaded artifact, with zero mismatches. Original CI failure log is retained alongside it. This location is outside removable worktrees and retained while #585 remains open. Investigation is separated from #571; historical failures are not claimed fixed.

  3. added
    in-progress
    on Nov 13, 2026
  4. thomhurst commented on Nov 13, 2026

    @thomhurst
    OwnerAuthor

    Implemented in draft #587 at 1ac29a23991b3f4b9464c0164126d380bd442d9b. A deterministic forced first native timer-queue contention reproduces the actual 312,056 B versus 312,000 B failure on Linux x64/.NET 10.0.15 and macOS ARM64/.NET 10.0.14. Native profiler callbacks identify AutoResetEvent (24 B) plus SafeWaitHandle (32 B), with zero failures; a separate warmed native CancelAfter control allocates 56 B on first contention and 0 B on its second. This establishes a deterministic mechanism, without claiming reconstruction of the historical window.

    The fix warms native timer-queue Lock contention in test setup and removes the existing NotInParallel attribute. Finite deadlines, actual buffered sends, parallel execution and exact equality stay enabled. Forced before/after controls pass their expected outcomes on both platforms. All 44 BatchPipelineTests pass on each of net10.0 and net11.0 on macOS (88 total), and 44/44 pass on Linux x64/.NET 10.0.15. Native profiler fixture: 8/8. No production API/behavior change, no docs impact, 0 B production per-message cost added.

    Evidence: /Users/tom/git/Relayer-evidence/pr-587/1ac29a23991b3f4b9464c0164126d380bd442d9b/; all 1,706 entries independently length/SHA-256 verified against originals and read back, inventory SHA-256 a3f56ca232d41176f6f6279d42b84ee6c0416f3d0bf7b1a630948148d940c8ef. Includes failed and passing diagnostic outcomes, probe sources, loaded test/runtime binaries, profiler SDK and original CI failure log. No passing diagnostic replaces the historical failure.

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

    P2area: testingin-progressphase-0: core

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions