dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.42k stars 4.76k forks source link

Hitting assert in NibbleMapDeleteUnlocked #109970

Closed kunalspathak closed 1 day ago

kunalspathak commented 2 days ago

Introduced in https://github.com/dotnet/runtime/pull/108939


Assert failure(PID 21700 [0x000054c4], Thread: 47520 [0xb9a0]): ((*pMap) & ~mask) && !IsPointer(*pMap)

CORECLR! EEJitManager::NibbleMapDeleteUnlocked + 0x158 (0x00007ff9`161db138)
CORECLR! EEJitManager::RemoveJitData + 0x1AA (0x00007ff9`161dc9ea)
CORECLR! CEEJitInfo::BackoutJitData + 0xD9 (0x00007ff9`15a60109)
CORECLR! invokeCompileMethod + 0x195 (0x00007ff9`15a99d95)
CORECLR! UnsafeJitFunction + 0x83C (0x00007ff9`15a6e08c)
CORECLR! MethodDesc::JitCompileCodeLocked + 0x1D2 (0x00007ff9`15b45882)
CORECLR! MethodDesc::JitCompileCodeLockedEventWrapper + 0x50D (0x00007ff9`15b4610d)
CORECLR! MethodDesc::JitCompileCode + 0x5AB (0x00007ff9`15b455ab)
CORECLR! MethodDesc::PrepareILBasedCode + 0x50C (0x00007ff9`15b47f4c)
CORECLR! MethodDesc::PrepareCode + 0xF3 (0x00007ff9`15b479e3)
    File: Q:\git\runtime2\src\coreclr\vm\codeman.cpp:4148
    Image: q:\git\runtime2\artifacts\tests\coreclr\windows.x64.Checked\tests\Core_Root\corerun.exe

It always repros with AltJit.

@steveisok @max-charlamb

steveisok commented 2 days ago

@kunalspathak is AltJit doing something it shouldn't as a result of hitting this assert?

kunalspathak commented 2 days ago

@kunalspathak is AltJit doing something it shouldn't as a result of hitting this assert?

It is not doing anything differently than what it should. The easiest way to repro would be to run any hello world app with following environment variables set:

DOTNET_AltJit=*
DOTNET_AltJitName=clrjit_universal_arm64_x64.dll
dotnet-policy-service[bot] commented 2 days ago

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

max-charlamb commented 2 days ago

108939 changed the assert condition to disallow "no-op" deletes. Looking at this example and other uses of CEEJitInfo::BackoutJitData, it seems expected to sometimes delete empty nibbles.

I have created #109976 to relax the assertion and added a comment explaining that no-op deletes can occur.