Skip to content

net7.0 app crashes in ProfilerAddNewRegion after profiler attach #78831

@k15tfu

Description

@k15tfu

Hi!

I faced with the following crash in .NET 7 app on Windows x64 after attaching the profiler:

Exception thrown at 0x00007FFD6979E634 (coreclr.dll) in ....exe: 0xC0000005: Access violation reading location 0x0000000000000028.

 	coreclr.dll!CrstBase::Enter() Line 292	C++
>	[Inline Frame] coreclr.dll!CrstBase::AcquireLock(CrstBase *) Line 187	C++
 	[Inline Frame] coreclr.dll!CrstBase::CrstHolder::{ctor}(CrstBase *) Line 378	C++
 	coreclr.dll!GenerationTable::AddRecord(int generation=0x00000000, unsigned char * rangeStart=0x0000022fb8000020, unsigned char * rangeEnd=0x0000022fb8000020, unsigned char * rangeEndReserved=0x0000022fb8400000) Line 766	C++
 	[Inline Frame] coreclr.dll!ProfilerAddNewRegion(int) Line 968	C++
 	[Inline Frame] coreclr.dll!GCToEEInterface::DiagAddNewRegion(int generation, unsigned char * rangeStart, unsigned char * rangeEnd, unsigned char * rangeEndReserved) Line 1786	C++
 	coreclr.dll!SVR::gc_heap::soh_try_fit(int gen_number=0x00000000, unsigned __int64 size=0x0000000000000128, alloc_context * acontext=0x0000027024fb1418, unsigned int flags=0x00000000, int align_const=0x00000007, int * commit_failed_p=0x000000cc4a97bec4, int * short_seg_end_p=0x0000000000000000) Line 17015	C++
 	coreclr.dll!SVR::gc_heap::allocate_soh(int gen_number=0x00000000, unsigned __int64 size=0x0000000000000128, alloc_context * acontext=0x0000027024fb1418, unsigned int flags=0x00000000, int align_const=0x00000007) Line 17100	C++
 	coreclr.dll!SVR::gc_heap::try_allocate_more_space(alloc_context * acontext=0x0000027024fb1418, unsigned __int64 size=0x0000000000000128, unsigned int flags=0x00000000, int gen_number=0x00000000) Line 18052	C++
 	[Inline Frame] coreclr.dll!SVR::gc_heap::allocate_more_space(alloc_context *) Line 18499	C++
 	[Inline Frame] coreclr.dll!SVR::gc_heap::allocate(unsigned __int64) Line 18555	C++
 	coreclr.dll!SVR::GCHeap::Alloc(gc_alloc_context * context=0x0000027024fb1418, unsigned __int64 size=0x0000000000000128, unsigned int flags=0x00000000) Line 46244	C++
 	coreclr.dll!Alloc(unsigned __int64 size=0x0000000000000128, GC_ALLOC_FLAGS flags) Line 227	C++
 	coreclr.dll!AllocateString(unsigned long cchStringLength=0x00000089) Line 858	C++
 	coreclr.dll!FramedAllocateString(unsigned long stringLength=0x00000089) Line 2415	C++
 	00007ffd0fbef940()	Unknown

Here is disasm of the 1st frame:

   00007FFD6979E620  mov         qword ptr [rsp+8],rbx  
   00007FFD6979E625  mov         qword ptr [rsp+10h],rbp  
   00007FFD6979E62A  mov         qword ptr [rsp+18h],rsi  
   00007FFD6979E62F  push        rdi  
   00007FFD6979E630  sub         rsp,20h  
-> 00007FFD6979E634  test        dword ptr [rcx+28h],10Ch  -- rcx = 0x0000000000000000 
   00007FFD6979E63B  mov         rsi,rcx  
   00007FFD6979E63E  mov         edx,dword ptr [_tls_index (07FFD69C4F748h)]  
   00007FFD6979E644  mov         rax,qword ptr gs:[58h]  

.NET 7.0.0, or latest public .NET SDK 7.0.200-preview.22571.16 (https://dotnetbuilds.azureedge.net/public/Sdk/7.0.200-preview.22571.16/dotnet-sdk-7.0.200-win-x64.zip)
Windows 10 21H2

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions