Skip to content

Conversation

@mdh1418
Copy link
Member

@mdh1418 mdh1418 commented Feb 10, 2026

Manual backport of #123226 and #124055 to release/10.0

Customer Impact

  • Customer reported
  • Found internally

The DiagnosticServer allows profilers to enable PerfMap early in start-up, even before PerfMap is initialized and dependencies are ready, inducing a crash. Enabling PerfMap this early in start-up was not tested until user_events support was added in .NET 10, where One-Collect's record-trace aggressively enables PerfMaps as soon as it connects to a .NET Process so it can resolve JIT'd code. As .NET user_events + record-trace gains more users, this crash will likely be observed more frequently.

With the changes in the two PRs, the runtime is resilient to early PerfMap::Enable commands received by the DiagnosticServer.
DiagnosticServer initialization will still be early in start-up, PerfMap initialization is just bumped right before it.

Regression

  • Yes
  • No

Testing

I validated on a wsl2 instance, pausing the startup logic with DOTNET_DefaultDiagnosticPortSuspend=1 and kicking off a separate app invoking DiagnosticClient.EnablePerfMap. Before the change, it would sigsegv and crash.
After the changes, its resilient and doesn't crash.

Risk

Low. PerfMap initialization doesn't depend on the logic between its former and proposed location. The logic to handle early IPC PerfMap Enable commands makes the problematic logic a no-op until the dependencies are ready.

Copilot AI review requested due to automatic review settings February 10, 2026 01:42
@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @agocke
See info in area-owners.md if you want to be subscribed.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Backports fixes to CoreCLR startup/diagnostics so an early DiagnosticServer IPC EnablePerfMap command (e.g., during PauseForDiagnosticsMonitor) no longer crashes the runtime by invoking PerfMap “send existing” logic before the AppDomain / EEJitManager are initialized.

Changes:

  • Move PerfMap::Initialize() earlier in EEStartupHelper() so PerfMap infrastructure is ready before DiagnosticServerAdapter::Initialize() starts listening for IPC.
  • Add a PerfMap readiness flag to gate sendExisting behavior until startup dependencies are initialized.
  • Signal readiness (PerfMap::SignalDependenciesReady()) immediately after ExecutionManager::Init().

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/coreclr/vm/perfmap.h Adds a new volatile readiness flag and a public signal API to indicate when sendExisting can safely run.
src/coreclr/vm/perfmap.cpp Implements the readiness flag, skips sendExisting enumeration if dependencies aren’t ready, and adds SignalDependenciesReady().
src/coreclr/vm/ceemain.cpp Reorders PerfMap initialization ahead of DiagnosticServer startup and signals readiness after ExecutionManager::Init().

@mdh1418
Copy link
Member Author

mdh1418 commented Feb 10, 2026

/ba-g "Known infrastructure issue"

@hoyosjs
Copy link
Member

hoyosjs commented Feb 10, 2026

/ba-g known pkg_resources issue

@steveisok steveisok added the Servicing-approved Approved for servicing release label Feb 11, 2026
@steveisok steveisok enabled auto-merge (squash) February 11, 2026 13:17
@steveisok steveisok merged commit 190c0c2 into dotnet:release/10.0 Feb 11, 2026
105 of 112 checks passed
@steveisok steveisok deleted the backport/prs-123226-124055-to-release/10.0 branch February 11, 2026 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-VM-coreclr Servicing-approved Approved for servicing release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants