Skip to content

Speed up blame tests by filtering non-.NET processes from dump collection#15518

Merged
nohwnd merged 3 commits into
microsoft:mainfrom
nohwnd:optimize-blame-hang-dumper
Mar 19, 2026
Merged

Speed up blame tests by filtering non-.NET processes from dump collection#15518
nohwnd merged 3 commits into
microsoft:mainfrom
nohwnd:optimize-blame-hang-dumper

Conversation

@nohwnd

@nohwnd nohwnd commented Mar 19, 2026

Copy link
Copy Markdown
Member

Summary

Speeds up blame/hang dump tests by filtering out non-.NET processes (\conhost, \WerFault, \createdump) from the process tree before attempting dump collection. This avoids the 30s DiagnosticsClient timeout that occurs when trying to connect to native processes.

Also fixes the implicit full hang dump in \CrashDumpWhenThereIsNoTimeout\ and reduces child process tree depth.

Changes

  • *\NetClientHangDumper.cs* — filter \conhost/\WerFault/\createdump\ from process tree (fixes the 30s timeout per non-.NET process)
  • *\WindowsHangDumper.cs* — add \createdump\ to existing filter
  • *\BlameDataCollectorTests.cs* — add \HangDumpType=mini\ where it defaulted to Full
  • *\child-hang/child-crash* — reduce process tree from 3→2 children

Results

Test Before After Savings
\HangDumpChildProcesses\ 39.4s 16.1s 59%
\CrashDumpChildProcesses\ 32.3s 17.9s 45%
\CrashDumpWhenThereIsNoTimeout\ (2 variants) 62.4s 39.7s 36%

…tion

- Filter conhost/WerFault/createdump from NetClientHangDumper process tree,
  avoiding 30s DiagnosticsClient timeout per non-.NET process
- Apply same createdump filter to WindowsHangDumper
- Add HangDumpType=mini where hang dump defaulted to Full
- Reduce child-crash/child-hang process tree from 3 to 2 children

Results:
- HangDumpChildProcesses: 39.4s -> 16.1s (59% faster)
- CrashDumpChildProcesses: 32.3s -> 17.9s (45% faster)
- CrashDumpWhenThereIsNoTimeout: 62.4s -> 39.7s (36% faster)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 19, 2026 14:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR speeds up blame/hang dump collection by avoiding attempts to collect dumps from known non-.NET helper processes, which prevents repeated 30s DiagnosticsClient timeouts and reduces overall test runtime.

Changes:

  • Filter out conhost, WerFault, and createdump from dump collection process trees.
  • Fix hang dump configuration to explicitly use mini dumps where it previously defaulted to full.
  • Simplify child process trees in test assets to reduce dump count and execution time.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
test/TestAssets/child-hang/UnitTest1.cs Reduces hang test child process depth and adjusts expected dump count/comments.
test/TestAssets/child-crash/UnitTest1.cs Reduces crash test child process depth and adjusts expected dump count/comments.
test/Microsoft.TestPlatform.TestUtilities/IntegrationTestBuild.cs Splits timing logs for unzip/build/compatibility build steps.
test/Microsoft.TestPlatform.Acceptance.IntegrationTests/BlameDataCollectorTests.cs Adjusts blame args (mini hang dumps) and test target frameworks; adds diagnostic logging.
src/Microsoft.TestPlatform.Extensions.BlameDataCollector/WindowsHangDumper.cs Extends helper-process filter to include createdump.
src/Microsoft.TestPlatform.Extensions.BlameDataCollector/NetClientHangDumper.cs Filters non-.NET helper processes before using DiagnosticsClient; fixes verbose log to use correct PID.

Comment thread src/Microsoft.TestPlatform.Extensions.BlameDataCollector/NetClientHangDumper.cs Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Jakub Jareš <me@jakubjares.com>
Copilot AI review requested due to automatic review settings March 19, 2026 15:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR optimizes blame/hang dump collection tests by avoiding dump attempts against known non-.NET helper processes that trigger DiagnosticsClient timeouts, and updates associated test assets/config to reduce overall runtime.

Changes:

  • Filter non-.NET processes (e.g., conhost/WerFault/createdump) out of process-tree dump collection to avoid per-process 30s timeouts.
  • Explicitly set hang dump type to mini in CrashDumpWhenThereIsNoTimeout and reduce child process fan-out in test assets.
  • Adjust test coverage scope/target frameworks and refine integration build timing logs.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
test/TestAssets/child-hang/UnitTest1.cs Reduce hanging process tree depth (2 procs instead of 3) and update expected dump count comments.
test/TestAssets/child-crash/UnitTest1.cs Reduce crashing process tree depth (2 procs instead of 3) and update expected dump count comments.
test/Microsoft.TestPlatform.TestUtilities/IntegrationTestBuild.cs Split build/unzip timing logs into more granular steps.
test/Microsoft.TestPlatform.Acceptance.IntegrationTests/BlameDataCollectorTests.cs Force HangDumpType=mini and narrow HangDumpChildProcesses runner target.
src/Microsoft.TestPlatform.Extensions.BlameDataCollector/WindowsHangDumper.cs Exclude createdump from hang dump process-tree enumeration on Windows.
src/Microsoft.TestPlatform.Extensions.BlameDataCollector/NetClientHangDumper.cs Exclude non-.NET helper processes from process tree before using DiagnosticsClient; fix verbose log to use child proc ID.

Comment thread test/Microsoft.TestPlatform.TestUtilities/IntegrationTestBuild.cs
Comment thread test/Microsoft.TestPlatform.TestUtilities/IntegrationTestBuild.cs
Copilot AI review requested due to automatic review settings March 19, 2026 15:47
@nohwnd nohwnd merged commit 27f1de5 into microsoft:main Mar 19, 2026
1 of 4 checks passed
@nohwnd

nohwnd commented Mar 19, 2026

Copy link
Copy Markdown
Member Author

Passsed windows build

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Speeds up blame/hang dump tests by avoiding dump attempts against known non-.NET helper processes (which trigger DiagnosticsClient timeouts), and adjusts test assets/config to reduce unnecessary dump collection and process-tree depth.

Changes:

  • Filter conhost/WerFault/createdump out of hang/crash process trees before collecting dumps.
  • Set HangDumpType=mini where hang dumps were implicitly full.
  • Reduce child test asset process-tree depth and refine build timing logs.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
test/TestAssets/child-hang/UnitTest1.cs Reduces hanging process tree depth and updates expectations/comments.
test/TestAssets/child-crash/UnitTest1.cs Reduces crash process tree depth and updates expectations/comments.
test/Microsoft.TestPlatform.TestUtilities/IntegrationTestBuild.cs Splits timing logs for unzip/build/compat steps.
test/Microsoft.TestPlatform.Acceptance.IntegrationTests/BlameDataCollectorTests.cs Forces mini hang dumps in CrashDumpWhenThereIsNoTimeout args; removes TODO.
src/Microsoft.TestPlatform.Extensions.BlameDataCollector/WindowsHangDumper.cs Filters createdump from process tree before dump.
src/Microsoft.TestPlatform.Extensions.BlameDataCollector/NetClientHangDumper.cs Filters native helper processes from process tree; fixes verbose log process id.

else
{
Debug.WriteLine("BuildCompatibility parameter is false, skipping build.");
}
{
var process = Process.GetProcessById(processId);
var processTree = process.GetProcessTree().Where(p => p.Process?.ProcessName is not null and not "conhost" and not "WerFault").ToList();
var processTree = process.GetProcessTree().Where(p => p.Process?.ProcessName is not null and not "conhost" and not "WerFault" and not "createdump").ToList();
// There is 30s timeout hardcoded for the NetClient, so if we try to connect to a non-net process it will take 30s to timeout.
// https://github.com/dotnet/diagnostics/blob/main/src/Microsoft.Diagnostics.NETCore.Client/DiagnosticsIpc/IpcClient.cs#L15
// We run this in parallel so it okay, but we are never interested in dumping the native helper processes of Windows, nor we can dump them.
var processTree = process.GetProcessTree().Where(p => p.Process?.ProcessName is not null and not "conhost" and not "WerFault" and not "createdump").ToList();
var processTree = process.GetProcessTree();
// There is 30s timeout hardcoded for the NetClient, so if we try to connect to a non-net process it will take 30s to timeout.
// https://github.com/dotnet/diagnostics/blob/main/src/Microsoft.Diagnostics.NETCore.Client/DiagnosticsIpc/IpcClient.cs#L15
// We run this in parallel so it okay, but we are never interested in dumping the native helper processes of Windows, nor we can dump them.
var processTree = process.GetProcessTree();
// There is 30s timeout hardcoded for the NetClient, so if we try to connect to a non-net process it will take 30s to timeout.
// https://github.com/dotnet/diagnostics/blob/main/src/Microsoft.Diagnostics.NETCore.Client/DiagnosticsIpc/IpcClient.cs#L15
// We run this in parallel so it okay, but we are never interested in dumping the native helper processes of Windows, nor we can dump them.
This was referenced May 26, 2026
This was referenced Jun 11, 2026
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.

2 participants