Skip to content

PerfMap Reenable Crashing from AssemblyIterator IterateAssembliesEx #123438

Closed

Description

@mdh1418

Description

PerfMap allows re-enabling through the DiagnosticServer IPC Command PerfMapEnable.
Doing so early in startup (e.g. userevents tests) has led to crashes such as #122472 and the following

00 0000f12a`161eeae0 0000f12a`15b4f918     libc_so+0xd5154
01 0000f12a`161eeb10 0000f12a`15b503c8     libcoreclr!PROCCreateCrashDump+0x510 [/__w/1/s/src/coreclr/pal/src/thread/process.cpp @ 2573] 
02 0000f12a`161eeb90 0000f12a`15b1a8e0     libcoreclr!PROCCreateCrashDumpIfEnabled+0x320 [/__w/1/s/src/coreclr/pal/src/thread/process.cpp @ 2822] 
03 0000f12a`161eed00 0000f12a`15b19b5c     libcoreclr!invoke_previous_action+0x1ac [/__w/1/s/src/coreclr/pal/src/exception/signal.cpp @ 439] 
04 0000f12a`161eed50 0000f12a`1627f7a0     libcoreclr!sigsegv_handler+0x1c8
05 0000f12a`161eeda0 0000f12a`157e6458     linux_vdso_so!_kernel_rt_sigreturn
06 (Inline Function) --------`--------     libcoreclr!AppDomain::AssemblyIterator::Create+0x24 [/__w/1/s/src/coreclr/vm/appdomain.hpp @ 1022] 
07 (Inline Function) --------`--------     libcoreclr!AppDomain::IterateAssembliesEx+0x24 [/__w/1/s/src/coreclr/vm/baseassemblyspec.h @ 1032] 
08 0000f129`d4a1e460 0000f12a`1552c7cc     libcoreclr!PerfMap::Enable+0x1a8 [/__w/1/s/src/coreclr/inc/sstring.h @ 124] 
09 (Inline Function) --------`--------     libcoreclr!ds_rt_enable_perfmap+0x18 [/__w/1/s/src/coreclr/vm/eventing/eventpipe/ds-rt-coreclr.h @ 317] 
0a (Inline Function) --------`--------     libcoreclr!process_protocol_helper_enable_perfmap+0x80 [/__w/1/s/src/native/eventpipe/ds-portable-rid.c @ 1072] 
0b 0000f129`d4a1e640 0000f12a`155315e8     libcoreclr!ds_process_protocol_helper_handle_ipc_message+0x31c [/__w/1/s/src/native/eventpipe/ds-portable-rid.c @ 1245] 
0c (Inline Function) --------`--------     libcoreclr!server_loop_tick+0x198 [/__w/1/s/src/native/eventpipe/ds-server.c @ 158] 
0d 0000f129`d4a1e7e0 0000f12a`15b52d98     libcoreclr!server_thread+0x270 [/__w/1/s/src/native/eventpipe/ds-protocol.c @ 185] 
0e 0000f129`d4a1e860 0000f12a`15ce0944     libcoreclr!CorUnix::CPalThread::ThreadEntry+0x350 [/__w/1/s/src/coreclr/pal/src/thread/thread.cpp @ 1601] 
0f 0000f129`d4a1e920 0000f12a`15d46ccc     libc_so+0x80944
10 0000f129`d4a1ea40 ffffffff`ffffffff     libc_so+0xe6ccc
11 0000f129`d4a1ea40 00000000`00000000     0xffffffff`ffffffff

This crash, after bumping PerfMap::Initialize earlier in start-up, reveals that PerfMap Reenable (sendExisting=true) assumes that the command is only sent once AppDomain's AssemblyIterator is able to IterateAssembliesEx.

This is a seldomly hit scenario rather than a regression. Its only being hit now because userevents tests spin up RecordTrace before starting tracee apps and RecordTrace identifies .NET processes and sends a PerfMap Enable IPC Command as early as possible.

The fix is likely gracefully handling assembly iteration at

AppDomain::AssemblyIterator assemblyIterator = GetAppDomain()->IterateAssembliesEx(
(AssemblyIterationFlags)(kIncludeLoaded | kIncludeExecution));

Reproduction Steps

Send Enable PerfMap IPC command early in startup

Expected behavior

No crash

Actual behavior

Crashes

Regression?

No

Known Workarounds

Don't send IPC command early in app startup

Configuration

No response

Other information

No response

Activity

  1. added
    needs-area-labelAn area label is needed to ensure this gets routed to the appropriate area owners
    on Jan 21, 2026
  2. dotnet-policy-service commented on Jan 21, 2026

    @dotnet-policy-service
    Contributor

    Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag
    See info in area-owners.md if you want to be subscribed.

  3. removed
    untriagedNew issue has not been triaged by the area owner
    needs-area-labelAn area label is needed to ensure this gets routed to the appropriate area owners
    on Jan 22, 2026
  4. added a commit that references this issue on Feb 10, 2026
    b7db56a
  5. added a commit that references this issue on Mar 2, 2026
    0ee3bd3
  6. locked and limited conversation to collaborators on Mar 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions