Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test failure: JIT/jit64/mcc/interop/mcc_i03/mcc_i03.cmd #108640

Open
v-wenyuxu opened this issue Oct 8, 2024 · 16 comments · May be fixed by #109006
Open

Test failure: JIT/jit64/mcc/interop/mcc_i03/mcc_i03.cmd #108640

v-wenyuxu opened this issue Oct 8, 2024 · 16 comments · May be fixed by #109006
Assignees
Labels
arch-x86 area-NativeAOT-coreclr blocking-clean-ci-optional Blocking optional rolling runs in-pr There is an active PR which will close this issue when it is merged os-windows tracking-external-issue The issue is caused by external problem (e.g. OS) - nothing we can do to fix it directly
Milestone

Comments

@v-wenyuxu
Copy link

Failed in: runtime-coreclr r2r 20241006.1

Failed tests:

R2R-CG2 windows x86 Checked @ Windows.10.Amd64.Open
    - JIT/jit64/mcc/interop/mcc_i03/mcc_i03.cmd

Error message:

 
Return code:      1
Raw output file:      C:hwA7CB08E3wB59C09C8uploadsmccinteropmcc_i03output.txt
Raw output:
BEGIN EXECUTION
mcc_i03.dll
native_i0c.dll
native_i0s.dll
native_i1c.dll
native_i1s.dll
native_i3c.dll
native_i3s.dll
native_i5c.dll
native_i5s.dll
native_i6c.dll
native_i6s.dll
native_i7c.dll
native_i7s.dll
native_i8c.dll
native_i8s.dll
       15 file(s) copied.
 6:57:42.77
Response file: C:hwA7CB08E3wB59C09C8eJITjit64mccinteropmcc_i03mcc_i03.dll.rsp
C:hwA7CB08E3wB59C09C8eJITjit64mccinteropmcc_i03IL-CG2mcc_i03.dll
-o:C:hwA7CB08E3wB59C09C8eJITjit64mccinteropmcc_i03mcc_i03.dll
--targetarch:x86
--targetos:windows
--verify-type-and-field-layout
--method-layout:random
-r:C:hwA7CB08E3pSystem.*.dll
-r:C:hwA7CB08E3pMicrosoft.*.dll
-r:C:hwA7CB08E3p\xunit.*.dll
-r:C:hwA7CB08E3pmscorlib.dll
-r:C:hwA7CB08E3p
etstandard.dll
"Running CrossGen2:  "C:hwA7CB08E3pcrossgen2crossgen2.exe" @"C:hwA7CB08E3wB59C09C8eJITjit64mccinteropmcc_i03mcc_i03.dll.rsp"   -r:C:hwA7CB08E3wB59C09C8eJITjit64jit64_2IL-CG2*.dll  -r:C:hwA7CB08E3wB59C09C8eJITjit64mccinteropmcc_i03IL-CG2*.dll"
Emitting R2R PE file: C:hwA7CB08E3wB59C09C8eJITjit64mccinteropmcc_i03mcc_i03.dll
"Running R2RDump:  "dotnet" "C:hwA7CB08E3p
2rdump
2rdump.dll" --header --sc --in C:hwA7CB08E3wB59C09C8eJITjit64mccinteropmcc_i03mcc_i03.dll --out C:hwA7CB08E3wB59C09C8eJITjit64mccinteropmcc_i03mcc_i03.dll.r2rdump --val"
 6:57:43.60
 6:57:43.60
Response file: C:hwA7CB08E3wB59C09C8eJITjit64mccinteropmcc_i03
ative_i0c.dll.rsp
C:hwA7CB08E3wB59C09C8eJITjit64mccinteropmcc_i03IL-CG2
ative_i0c.dll
-o:C:hwA7CB08E3wB59C09C8eJITjit64mccinteropmcc_i03
ative_i0c.dll
--targetarch:x86
--targetos:windows
--verify-type-and-field-layout
--method-layout:random
-r:C:hwA7CB08E3pSystem.*.dll
-r:C:hwA7CB08E3pMicrosoft.*.dll
-r:C:hwA7CB08E3p\xunit.*.dll
-r:C:hwA7CB08E3pmscorlib.dll
-r:C:hwA7CB08E3p
etstandard.dll
"Running CrossGen2:  "C:hwA7CB08E3pcrossgen2crossgen2.exe" @"C:hwA7CB08E3wB59C09C8eJITjit64mccinteropmcc_i03
ative_i0c.dll.rsp"   -r:C:hwA7CB08E3wB59C09C8eJITjit64jit64_2IL-CG2*.dll  -r:C:hwA7CB08E3wB59C09C8eJITjit64mccinteropmcc_i03IL-CG2*.dll"
No input files are loadable
 6:57:43.66
 6:57:43.66
Response file: C:hwA7CB08E3wB59C09C8eJITjit64mccinteropmcc_i03
ative_i0s.dll.rsp
C:hwA7CB08E3wB59C09C8eJITjit64mccinteropmcc_i03IL-CG2
ative_i0s.dll
-o:C:hwA7CB08E3wB59C09C8eJITjit64mccinteropmcc_i03
ative_i0s.dll
--targetarch:x86
--targetos:windows
--verify-type-and-field-layout
--method-layout:random
-r:C:hwA7CB08E3pSystem.*.dll
-r:C:hwA7CB08E3pMicrosoft.*.dll
-r:C:hwA7CB08E3p\xunit.*.dll
-r:C:hwA7CB08E3pmscorlib.dll
-r:C:hwA7CB08E3p
etstandard.dll
"Running CrossGen2:  "C:hwA7CB08E3pcrossgen2crossgen2.exe" @"C:hwA7CB08E3wB59C09C8eJITjit64mccinteropmcc_i03
ative_i0s.dll.rsp"   -r:C:hwA7CB08E3wB59C09C8eJITjit64jit64_2IL-CG2*.dll  -r:C:hwA7CB08E3wB59C09C8eJITjit64mccinteropmcc_i03IL-CG2*.dll"
No input files are loadable
 6:57:43.71
 6:57:43.72
Response file: C:hwA7CB08E3wB59C09C8eJITjit64mccinteropmcc_i03
ative_i1c.dll.rsp
C:hwA7CB08E3wB59C09C8eJITjit64mccinteropmcc_i03IL-CG2
ative_i1c.dll
-o:C:hwA7CB08E3wB59C09C8eJITjit64mccinteropmcc_i03
ative_i1c.dll
--targetarch:x86
--targetos:windows
--verify-type-and-field-layout
--method-layout:random
-r:C:hwA7CB08E3pSystem.*.dll
-r:C:hwA7CB08E3pMicrosoft.*.dll
-r:C:hwA7CB08E3p\xunit.*.dll
-r:C:hwA7CB08E3pmscorlib.dll
-r:C:hwA7CB08E3p
etstandard.dll
"Running CrossGen2:  "C:hwA7CB08E3pcrossgen2crossgen2.exe" @"C:hwA7CB08E3wB59C09C8eJITjit64mccinteropmcc_i03
ative_i1c.dll.rsp"   -r:C:hwA7CB08E3wB59C09C8eJITjit64jit64_2IL-CG2*.dll  -r:C:hwA7CB08E3wB59C09C8eJITjit64mccinteropmcc_i03IL-CG2*.dll"
No input files are loadable
 6:57:43.77
 6:57:43.77
Response file: C:hwA7CB08E3wB59C09C8eJITjit64mccinteropmcc_i03
ative_i1s.dll.rsp
C:hwA7CB08E3wB59C09C8eJITjit64mccinteropmcc_i03IL-CG2
ative_i1s.dll
-o:C:hwA7CB08E3wB59C09C8eJITjit64mccinteropmcc_i03
ative_i1s.dll
--targetarch:x86
--targetos:windows
--verify-type-and-field-layout
--method-layout:random
-r:C:hwA7CB08E3pSystem.*.dll
-r:C:hw

Stack trace:

   at Xunit.Assert.True(Nullable`1 condition, String userMessage) in /_/src/Microsoft.DotNet.XUnitAssert/src/BooleanAsserts.cs:line 146
   at TestLibrary.OutOfProcessTest.RunOutOfProcessTest(String assemblyPath, String testPathPrefix)
   at Program.<<Main>$>g__TestExecutor4|0_5(StreamWriter tempLogSw, StreamWriter statsCsvSw, <>c__DisplayClass0_0&)
@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Oct 8, 2024
@jkotas jkotas added area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI and removed area-crossgen2-coreclr labels Oct 8, 2024
@JulieLeeMSFT JulieLeeMSFT removed the untriaged New issue has not been triaged by the area owner label Oct 8, 2024
@JulieLeeMSFT JulieLeeMSFT added this to the 9.0.0 milestone Oct 8, 2024
@JulieLeeMSFT
Copy link
Member

@jakobbotsch, PTAL.

@jakobbotsch
Copy link
Member

@am11 Where can I find the symbols for the ILC compiled crossgen2 in Core_Root? There is a dump available for this crash in crossgen2.exe, but I cannot find any symbols.

@jakobbotsch
Copy link
Member

The AV is inside the stack allocation probe helper, so it seems the problem here is a stack overflow. The stack trace is quite long indeed:
https://gist.github.com/jakobbotsch/9227e93e213dd23082b609b112141444

It seems to be stuck in some repeated EH dispatching state, perhaps due to bad EH generated by the JIT. Hard to investigate further without symbols.

cc @janvorli

@am11
Copy link
Member

am11 commented Oct 10, 2024

I think we are not copying symbols in CORE_ROOT right now. Meanwhile, we can take the git SHA from file properties, checkout runtime and build ./build.cmd clr+libs+packs <configuration> and then find crossgen2.pdb in artifacts/bin/...../crossgen2_publish

@janvorli
Copy link
Member

I'll try to repro it locally

@am11
Copy link
Member

am11 commented Oct 10, 2024

Do we get artifacts/bin in repro? (I don't recall it has been a while I downloaded the dumps)
If so, then the native crossgen.pdb should be under there.

@jakobbotsch
Copy link
Member

I think we are not copying symbols in CORE_ROOT right now. Meanwhile, we can take the git SHA from file properties, checkout runtime and build ./build.cmd clr+libs+packs <configuration> and then find crossgen2.pdb in artifacts/bin/...../crossgen2_publish

I'm somewhat skeptical that this will be simple (for one, I think my local toolset versions is not the exact same as CI is using to build).

Do we get artifacts/bin in repro? (I don't recall it has been a while I downloaded the dumps)
If so, then the native crossgen.pdb should be under there.

No, that's not included.

@jakobbotsch
Copy link
Member

jakobbotsch commented Oct 14, 2024

I was able to repro this with a local build by running the test in a loop while also loading my system (in my case by running SPMI replay in the background). Here is the full stack trace with symbols: https://gist.github.com/jakobbotsch/df0320ec2e72066a6f0d97a23527e65c

It looks like some sort of crash while trying to allocate memory in PalSetCurrentThreadName, but the stack trace does not make much sense to me (it seems like almost entirely C runtime code). Perhaps there is some heap corruption caused by us?

@jakobbotsch jakobbotsch added area-NativeAOT-coreclr and removed area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI labels Oct 14, 2024
@janvorli
Copy link
Member

janvorli commented Oct 14, 2024

This issue is a bug in UCRT. When ucrt is statically linked to exe, it deinitializes some locks it uses at exit. When a secondary thread is still running and calls into UCRT, e.g. to invoke malloc, the code tries to take the deinitized lock and crashes. In our case, the main thread is on the exit path and a secondary thread, one of the background GC threads, has just entered its thread function and ends up calling malloc from PalSetCurrentThreadName.
Thanks @jakobbotsch for sharing a dump from his local repro.

The following simple repro C app crashes with the same problem (UCRT must be debug version and linked statically):

#include <stdio.h>
#include <Windows.h>

DWORD __stdcall ThreadFunction(void* lpThreadParameter)
{
  for (int i = 0; i < 1000000; i++)
  {
    malloc(31);
    Sleep(1);
  }

  return 0;
}

int main(int argc, char** argv)
{
  CreateThread(NULL, 0, ThreadFunction, NULL, 0, NULL);
  exit(0);
}

The issue seems to have been fixed in UCRT in March 2024. But the ucrt we are using still doesn't contain the fix.

@jakobbotsch jakobbotsch added the tracking-external-issue The issue is caused by external problem (e.g. OS) - nothing we can do to fix it directly label Oct 14, 2024
@jakobbotsch jakobbotsch modified the milestones: 9.0.0, 10.0.0 Oct 14, 2024
@janvorli
Copy link
Member

Actually, it looks like the fix that was made in UCRT was for something slightly different.

@janvorli
Copy link
Member

I've discussed this with the UCRT devs and it is actually an expected behavior. When using secondary threads, the UCRT expects that those threads are either shut down or remain blocked during the shutdown if graceful shutdown is expected.
The way to fix the problem is either use quick_exit or TerminateProcess to skip the cleanup of UCRT during shutdown or link to the UCRT dynamically. In that case, the cleanup is done on DLL_PROCESS_DETACH.
@jkotas mentioned that the #107772 switched crossgen2 to use release CRT by default, so we should not see this specific crash anymore.

@MichalStrehovsky
Copy link
Member

@jkotas mentioned that the #107772 switched crossgen2 to use release CRT by default, so we should not see this specific crash anymore.

I've run into a different flavor of this crash in a test run just yesterday. A background thread had this:

47c 00000074`d4cfd5f0 00007ff7`9d22e88b     System_Security_Permissions_Tests!abort+0x1d [minkernel\crts\ucrt\src\appcrt\startup\abort.cpp @ 61] 
47d 00000074`d4cfd630 00007ff7`9d22dd78     System_Security_Permissions_Tests!__vcrt_getptd+0x1b [D:\a\_work\1\s\src\vctools\crt\vcruntime\src\internal\per_thread_data.cpp @ 166] 
47e 00000074`d4cfd670 00007ff9`1496906f     System_Security_Permissions_Tests!__CxxFrameHandler4+0x48 [D:\a\_work\1\s\src\vctools\crt\vcruntime\src\eh\risctrnsctrl.cpp @ 296] 
47f 00000074`d4cfd700 00007ff9`148f5bea     ntdll!RtlpExecuteHandlerForException+0xf
480 00000074`d4cfd730 00007ff9`1496805e     ntdll!RtlDispatchException+0x25a
481 00000074`d4cfde80 00007ff9`148dd4d1     ntdll!KiUserExceptionDispatch+0x2e
482 00000074`d4cfe580 00007ff9`148fa7bc     ntdll!RtlpWaitOnCriticalSection+0xb1
483 00000074`d4cfe680 00007ff9`148fa622     ntdll!RtlpEnterCriticalSectionContended+0x18c
484 00000074`d4cfe6e0 00007ff7`9d2692e7     ntdll!RtlEnterCriticalSection+0x42
485 00000074`d4cfe710 00007ff7`9d26031a     System_Security_Permissions_Tests!__acrt_lock+0x27 [minkernel\crts\ucrt\src\appcrt\internal\locks.cpp @ 55] 
486 00000074`d4cfe740 00007ff7`9d26078d     System_Security_Permissions_Tests!heap_alloc_dbg_internal+0x2a [minkernel\crts\ucrt\src\appcrt\heap\debug_heap.cpp @ 309] 
487 00000074`d4cfe7e0 00007ff7`9d25fc9f     System_Security_Permissions_Tests!heap_alloc_dbg+0x4d [minkernel\crts\ucrt\src\appcrt\heap\debug_heap.cpp @ 450] 
488 00000074`d4cfe830 00007ff7`9d235e1e     System_Security_Permissions_Tests!_malloc_dbg+0x2f [minkernel\crts\ucrt\src\appcrt\heap\debug_heap.cpp @ 496] 
489 00000074`d4cfe860 00007ff7`9d22bcf3     System_Security_Permissions_Tests!malloc+0x1e [minkernel\crts\ucrt\src\appcrt\heap\malloc.cpp @ 27] 
48a 00000074`d4cfe890 00007ff7`9d22a858     System_Security_Permissions_Tests!operator new+0x13 [D:\a\_work\1\s\src\vctools\crt\vcstartup\src\heap\new_scalar.cpp @ 36] 
48b 00000074`d4cfe8d0 00007ff7`9d1bd41b     System_Security_Permissions_Tests!operator new+0x18 [D:\a\_work\1\s\src\vctools\crt\vcstartup\src\heap\new_scalar_nothrow.cpp @ 31] 
48c (Inline Function) --------`--------     System_Security_Permissions_Tests!AllocHeap::_AllocNewBlock+0x44 [D:\a\_work\1\s\src\coreclr\nativeaot\Runtime\allocheap.cpp @ 177] 
48d 00000074`d4cfe910 00007ff7`9d1abab6     System_Security_Permissions_Tests!AllocHeap::_Alloc+0xcb [D:\a\_work\1\s\src\coreclr\nativeaot\Runtime\allocheap.cpp @ 103] 
48e 00000074`d4cfe960 00007ff7`9d1ac065     System_Security_Permissions_Tests!AllocateCache+0x1c6 [D:\a\_work\1\s\src\coreclr\nativeaot\Runtime\CachedInterfaceDispatch.cpp @ 302] 
48f 00000074`d4cfe9a0 00007ff7`9ce1678c     System_Security_Permissions_Tests!RhpUpdateDispatchCellCache+0xc5 [D:\a\_work\1\s\src\coreclr\nativeaot\Runtime\CachedInterfaceDispatch.cpp @ 487] 
490 00000074`d4cfe9f0 00007ff7`9d1bd865     System_Security_Permissions_Tests!S_P_CoreLib_System_Runtime_CachedInterfaceDispatch__RhpCidResolve_Worker+0x6c [/_/src/coreclr/nativeaot/Runtime.Base/src/System/Runtime/CachedInterfaceDispatch.cs @ 46] 
491 00000074`d4cfea50 00007ff7`9cdeac1a     System_Security_Permissions_Tests!ReturnFromUniversalTransition_DebugStepTailCall [D:\a\_work\1\s\src\coreclr\nativeaot\Runtime\amd64\UniversalTransition.asm @ 163] 
492 00000074`d4cfead0 00007ff7`9cde8740     System_Security_Permissions_Tests!S_P_CoreLib_System_Threading_Tasks_AwaitTaskContinuation__RunOrScheduleAction_0+0xda [/_/src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/TaskContinuation.cs @ 795] 
493 00000074`d4cfeb30 00007ff7`9d09d3eb     System_Security_Permissions_Tests!S_P_CoreLib_System_Threading_Tasks_Task__RunContinuations+0x80 [/_/src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs @ 3457] 
494 00000074`d4cfeba0 00007ff7`9d0a64ac     System_Security_Permissions_Tests!S_P_CoreLib_System_Threading_Tasks_Task_1<System___Canon>__TrySetResult+0x8b [/_/src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/Future.cs @ 388] 
495 00000074`d4cfebf0 00007ff7`9d0b03f9     System_Security_Permissions_Tests!S_P_CoreLib_System_Runtime_CompilerServices_AsyncTaskMethodBuilder_1<System___Canon>__SetExistingTaskResult+0x4c [/_/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/AsyncTaskMethodBuilderT.cs @ 494] 
496 00000074`d4cfec30 00007ff7`9cdda54c     System_Security_Permissions_Tests!xunit_execution_dotnet_Xunit_Sdk_TestAssemblyRunner_1__RunAsync_d__41<System___Canon>__MoveNext+0x569 [/_/src/xunit.execution/Sdk/Frameworks/Runners/TestAssemblyRunner.cs @ 231] 
497 00000074`d4cfecf0 00007ff7`9d0d804e     System_Security_Permissions_Tests!S_P_CoreLib_System_Threading_ExecutionContext__RunInternal+0xbc [/_/src/libraries/System.Private.CoreLib/src/System/Threading/ExecutionContext.cs @ 179] 
498 00000074`d4cfed60 00007ff7`9cdeac1a     System_Security_Permissions_Tests!S_P_CoreLib_System_Runtime_CompilerServices_AsyncTaskMethodBuilder_1_AsyncStateMachineBox_1<System___Canon__xunit_execution_dotnet_Xunit_Sdk_TestAssemblyRunner_1__RunAsync_d__41<System___Canon>>__MoveNext_0+0xae [/_/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/AsyncTaskMethodBuilderT.cs @ 366] 
499 00000074`d4cfedb0 00007ff7`9cde8740     System_Security_Permissions_Tests!S_P_CoreLib_System_Threading_Tasks_AwaitTaskContinuation__RunOrScheduleAction_0+0xda [/_/src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/TaskContinuation.cs @ 795] 
49a 00000074`d4cfee10 00007ff7`9d09d3eb     System_Security_Permissions_Tests!S_P_CoreLib_System_Threading_Tasks_Task__RunContinuations+0x80 [/_/src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs @ 3457] 
49b 00000074`d4cfee80 00007ff7`9d0a64ac     System_Security_Permissions_Tests!S_P_CoreLib_System_Threading_Tasks_Task_1<System___Canon>__TrySetResult+0x8b [/_/src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/Future.cs @ 388] 
49c 00000074`d4cfeed0 00007ff7`9cf5bec0     System_Security_Permissions_Tests!S_P_CoreLib_System_Runtime_CompilerServices_AsyncTaskMethodBuilder_1<System___Canon>__SetExistingTaskResult+0x4c [/_/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/AsyncTaskMethodBuilderT.cs @ 494] 
49d 00000074`d4cfef10 00007ff7`9cdda54c     System_Security_Permissions_Tests!xunit_execution_dotnet_Xunit_Sdk_XunitTestAssemblyRunner__RunTestCollectionsAsync_d__16__MoveNext+0xa00 [/_/src/xunit.execution/Sdk/Frameworks/Runners/XunitTestAssemblyRunner.cs @ 297] 
49e 00000074`d4cfefa0 00007ff7`9d0d4de0     System_Security_Permissions_Tests!S_P_CoreLib_System_Threading_ExecutionContext__RunInternal+0xbc [/_/src/libraries/System.Private.CoreLib/src/System/Threading/ExecutionContext.cs @ 179] 
49f 00000074`d4cff010 00007ff7`9cdeac1a     System_Security_Permissions_Tests!S_P_CoreLib_System_Runtime_CompilerServices_AsyncTaskMethodBuilder_1_AsyncStateMachineBox_1<System___Canon__xunit_execution_dotnet_Xunit_Sdk_XunitTestAssemblyRunner__RunTestCollectionsAsync_d__16>__MoveNext_0+0xa0 [/_/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/AsyncTaskMethodBuilderT.cs @ 366] 
4a0 00000074`d4cff060 00007ff7`9cde8740     System_Security_Permissions_Tests!S_P_CoreLib_System_Threading_Tasks_AwaitTaskContinuation__RunOrScheduleAction_0+0xda [/_/src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/TaskContinuation.cs @ 795] 
4a1 00000074`d4cff0c0 00007ff7`9d09d3eb     System_Security_Permissions_Tests!S_P_CoreLib_System_Threading_Tasks_Task__RunContinuations+0x80 [/_/src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs @ 3457] 
4a2 00000074`d4cff130 00007ff7`9d09daef     System_Security_Permissions_Tests!S_P_CoreLib_System_Threading_Tasks_Task_1<System___Canon>__TrySetResult+0x8b [/_/src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/Future.cs @ 388] 
4a3 00000074`d4cff180 00007ff7`9d09db6f     System_Security_Permissions_Tests!S_P_CoreLib_System_Threading_Tasks_UnwrapPromise_1<System___Canon>__TrySetFromTask+0x16f [/_/src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs @ 7513] 
4a4 00000074`d4cff1e0 00007ff7`9cde87af     System_Security_Permissions_Tests!S_P_CoreLib_System_Threading_Tasks_UnwrapPromise_1<System___Canon>__ProcessInnerTask+0x4f [/_/src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs @ 7537] 
4a5 00000074`d4cff220 00007ff7`9cde6c14     System_Security_Permissions_Tests!S_P_CoreLib_System_Threading_Tasks_Task__RunContinuations+0xef [/_/src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs @ 3475] 
4a6 00000074`d4cff290 00007ff7`9cde74df     System_Security_Permissions_Tests!S_P_CoreLib_System_Threading_Tasks_Task__FinishSlow+0x74 [/_/src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs @ 2028] 
4a7 00000074`d4cff2e0 00007ff7`9cde0b65     System_Security_Permissions_Tests!S_P_CoreLib_System_Threading_Tasks_Task__ExecuteWithThreadLocal+0xef [/_/src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs @ 2360] 
4a8 00000074`d4cff330 00007ff7`9cde549f     System_Security_Permissions_Tests!S_P_CoreLib_System_Threading_ThreadPoolWorkQueue__Dispatch+0x305 [/_/src/libraries/System.Private.CoreLib/src/System/Threading/ThreadPoolWorkQueue.cs @ 1101] 
4a9 00000074`d4cff3e0 00007ff9`14929faa     System_Security_Permissions_Tests!S_P_CoreLib_System_Threading_WindowsThreadPool__DispatchCallback+0x8f [/_/src/libraries/System.Private.CoreLib/src/System/Threading/WindowsThreadPool.cs @ 152] 
4aa 00000074`d4cff430 00007ff9`148d7086     ntdll!TppWorkpExecuteCallback+0x13a
4ab 00000074`d4cff480 00007ff9`12e453e0     ntdll!TppWorkerThread+0x686
4ac 00000074`d4cff770 00007ff9`148c485b     kernel32!BaseThreadInitThunk+0x10

While the main thread was already trying to exit:

00 00000074`d457f968 00007ff9`1491175e     ntdll!NtWaitForSingleObject+0x14
01 00000074`d457f970 00007ff9`14914378     ntdll!LdrpDrainWorkQueue+0x15e
02 00000074`d457f9b0 00007ff9`12e4c97b     ntdll!RtlExitUserProcess+0x28
03 00000074`d457f9e0 00007ff7`9d25c9bb     kernel32!ExitProcessImplementation+0xb
04 00000074`d457fa10 00007ff7`9d25c96c     System_Security_Permissions_Tests!exit_or_terminate_process+0x3b [minkernel\crts\ucrt\src\appcrt\startup\exit.cpp @ 142] 
05 00000074`d457fa40 00007ff7`9d25cc46     System_Security_Permissions_Tests!common_exit+0xac [minkernel\crts\ucrt\src\appcrt\startup\exit.cpp @ 288] 
06 00000074`d457faa0 00007ff7`9d22a53b     System_Security_Permissions_Tests!exit+0x16 [minkernel\crts\ucrt\src\appcrt\startup\exit.cpp @ 302] 
07 00000074`d457fad0 00007ff7`9d22a3de     System_Security_Permissions_Tests!__scrt_common_main_seh+0x14b [D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl @ 295] 
08 00000074`d457fb40 00007ff7`9d22a67e     System_Security_Permissions_Tests!__scrt_common_main+0xe [D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl @ 331] 
09 00000074`d457fb70 00007ff9`12e453e0     System_Security_Permissions_Tests!wmainCRTStartup+0xe [D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_wmain.cpp @ 17] 
0a 00000074`d457fba0 00007ff9`148c485b     kernel32!BaseThreadInitThunk+0x10

I'll send a PR to exit with quick_exit to improve reliability of our debug/checked runs.

@dotnet-policy-service dotnet-policy-service bot added the in-pr There is an active PR which will close this issue when it is merged label Oct 18, 2024
@jkotas
Copy link
Member

jkotas commented Oct 18, 2024

A background thread had this:

What is this background thread trying to do? Is there a run-away test that is missing wait for the async operations to finish before completing the test?

@jkotas
Copy link
Member

jkotas commented Oct 18, 2024

I've discussed this with the UCRT devs and it is actually an expected behavior.

Is this a recent UCRT behavior change? It is surprising that we have not seen this issue before.

@MichalStrehovsky
Copy link
Member

A background thread had this:

What is this background thread trying to do? Is there a run-away test that is missing wait for the async operations to finish before completing the test?

From the stack it looks like some xunit infrastructure stuff, not test code. The dump should still be available with runfo get-helix-payload -j 54c574b5-f58f-4a23-bbed-bc6ea4b3ec14 -w System.Security.Permissions.Tests -o c:\helix_payload\System.Security.Permissions.Tests in case I'm not looking at the right thing.

@jkotas
Copy link
Member

jkotas commented Oct 20, 2024

We have seen these issues occasionally before: dotnet/runtimelab#1487 (comment) . It appears that some recent changes in CRT implementation makes them more likely to be hit. It is unfortunate that this UCRT crash is considered "by design".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-x86 area-NativeAOT-coreclr blocking-clean-ci-optional Blocking optional rolling runs in-pr There is an active PR which will close this issue when it is merged os-windows tracking-external-issue The issue is caused by external problem (e.g. OS) - nothing we can do to fix it directly
Projects
Status: No status
Development

Successfully merging a pull request may close this issue.

7 participants