Skip to content

Reuse debugger sessions across SOS test collections - #6263

Draft
max-charlamb wants to merge 4 commits into
mainfrom
dev/max-charlamb/sos-dump-collections
Draft

max-charlamb wants to merge 4 commits into
mainfrom
dev/max-charlamb/sos-dump-collections

Conversation

@max-charlamb

@max-charlamb max-charlamb commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

Summary

Group single-stop SOS theory rows by dump/session affinity so related tests reuse one debugger session until their xUnit collection finishes, rather than repeatedly evicting and reopening the same dumps.

  • Preserve theories, MemberData matrices, command-oriented test classes, and individual row results. Use the standard xUnit runner and collection fixtures, not a custom production scheduler.
  • Migrate all 113 eligible methods, including nine Windows-only methods. Keep the two multi-stop methods and four live debugger-control methods as ordinary theories; live rows in migrated methods still use isolated live targets.
  • Use one backend-neutral budget for dump analyzers, live targets, dump capture, and hosting probes, synchronized with xUnit's effective parallelism (default: min(8, Environment.ProcessorCount)). Capture dumps before reserving analyzer sessions.
  • Serialize fixture initialization/disposal, allow initialization retries, reject reopening disposed fixtures and navigating collection cursors to another stop, and restore changed debugger state in finally blocks.
  • Default to conservative collection scheduling and document why aggressive runner overrides are unsupported. Add lifecycle, cancellation, discovery/serialization, shared-capacity, and low-concurrency stock-runner regressions.

This draft includes the prerequisite lease change from #6260 and subsequent main-branch updates.

Initial local results

One full Windows x64 run with Core .NET 10/.NET 11 and Cdb/dotnet-dump, including ordinary, live, multi-stop, and infrastructure tests:

999 cases: 992 passed, 7 expected platform skips, 0 failures or assembly errors. Wall time: 90.746 seconds.

All 994 cases in the pre-expansion discovery manifest remain; five additional regression cases bring the total to 999. The results contain 812 cases in 181 dump-affinity collections, with 57 collections spanning multiple test classes.

Earlier local full-suite measurements:

Variant Wall time
Original 13m28s
Session leases (#6260) 6m15s
This dump-collection implementation 1m31s

This is approximately 76% less wall time than the earlier lease-only sample. These are single local observations, not a controlled benchmark or a CI speedup claim: the earlier runs included profiling instrumentation and 990 cases, while the latest run includes additional infrastructure tests. Existing cached dumps were reused.

The 17 focused infrastructure cases also passed, including collection execution with one and two admission slots sharing a capacity-one fake debugger pool. Builds, focused infrastructure formatting, discovered-case reconciliation, helper DLL hash checks, and diff checks passed.

Helix SOS before/after timings

Compare the original pre-lease Debug build 1688123 with this PR's Debug build 1689139, at PR head 0f92cf832ccb74d2daeccb450d11a4a337af1f11.

These are MTP test-run summary durations inside Helix, excluding work-item setup and pipeline/queue time. The table covers eight matched shards, not the entire CI matrix.

SOS shard Before (seconds) After (seconds) Reduction
Linux x64 .NET 10 259.710 169.574 34.7%
Linux x64 .NET 11 547.228 283.336 48.2%
Windows x86 .NET 10 264.461 170.602 35.5%
Windows ARM64 .NET 10 302.719 227.279 24.9%
macOS ARM64 .NET 10 304.929 97.494 68.0%
Linux musl x64 .NET 10 176.204 91.577 48.0%
Windows x64 .NET 10 381.367 185.713 51.3%
Linux ARM64 .NET 10 317.486 167.204 47.3%
Sum of these eight shards 2,554.104 1,392.779 45.5%

The sum falls from 42m34.104s to 23m12.779s; this is accumulated runner time, not end-to-end CI wall time.

These are single observations on different Helix workers, not a controlled benchmark. The original source tree also predates mirrored cDAC/DBI updates present in the later builds, so the full reduction cannot be attributed exclusively to session reuse or scheduling.

CI validation and coverage audit

Compared the raw xUnit XML for all 31 paired SOS shards across seven platforms, matching exact test type, method, and full display name including parameters, with no name normalization:

  • 18,463 recorded existing SOS case identities match, excluding the intentionally changed pooling infrastructure tests. No missing/added scenarios, duplicate identities, or trait changes.
  • 18,459 outcomes are identical. Four .NET 8 cases differ: DumpGen_ReportsExactGenerationPopulations on Linux musl x64 changes Pass -> Skip for both Lldb and DotnetDump; EeHeap_ServerGc_IsMultiHeap on Linux x64 changes Skip -> Pass for those two hosts. All four use the existing createdump /proc/<pid>/mem permission-race skip.
  • Infrastructure tests add 30 cases and remove the obsolete per-backend DumpSessionsUseSeparateBoundedSlots case per shard: net +29 per shard / +899 overall.

Reporting caveat: both baseline and current XML contain 48 Cannot find test case metadata errors per build, with the corresponding individual test records absent. They affect the same collections in Windows x64/x86/ARM64 Framework (15 each) and .NET 12 (one each), despite green SOS work-item statuses. None of those six affected shards is included in the timing table above. This pre-existing reporting gap prevents certifying complete result equivalence or claiming SOS is entirely green. The audit verifies recorded test-case/matrix coverage, not instrumented line/branch coverage.

The current overall CI build failed on dotnet-trace child-process tests (VerifyShowIO and VerifyExitCode). Keep this PR in draft while those failures and the SOS reporting gap are investigated.

Keep the existing per-session lease across synchronous SOS command sequences to reduce pooled debugger eviction between commands. Preserve all test coverage and scheduling.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 4492c22e-8f9c-494f-a4fa-dfc6633e0a0f
Reuse collection-owned debugger sessions across eligible theory rows while preserving matrices and individual results. Bound grouped and ordinary sessions with shared slots, harden fixture lifetime, and cover conservative scheduling at low concurrency.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 4492c22e-8f9c-494f-a4fa-dfc6633e0a0f
@max-charlamb

Copy link
Copy Markdown
Member Author

/azp run diagnostics-public-ci

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

Share one bounded pool across dump analyzers, live targets, captures, and hosting probes. Derive its capacity from the effective xUnit collection parallelism and default both to min(8, processor count). Preserve coverage and stock conservative scheduling.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4492c22e-8f9c-494f-a4fa-dfc6633e0a0f
@max-charlamb

Copy link
Copy Markdown
Member Author

/azp run diagnostics-public-ci

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command.

@max-charlamb

Copy link
Copy Markdown
Member Author

/azp run diagnostics-public-ci

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command.

Keep unified xUnit concurrency while incorporating the merged lease, shared compilation, and trimmed CI payload changes. Resolve the Unix launcher conflict without restoring platform-specific thread caps.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4492c22e-8f9c-494f-a4fa-dfc6633e0a0f
@max-charlamb

Copy link
Copy Markdown
Member Author

/azp run diagnostics-public-ci

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant