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

NativeAOT tests crashing with infinite recursion in Lock #94227

Closed
jkotas opened this issue Oct 31, 2023 · 3 comments · Fixed by #94241
Closed

NativeAOT tests crashing with infinite recursion in Lock #94227

jkotas opened this issue Oct 31, 2023 · 3 comments · Fixed by #94241
Assignees
Labels
area-System.Threading blocking-clean-ci Blocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms'
Milestone

Comments

@jkotas
Copy link
Member

jkotas commented Oct 31, 2023

log and dump for System.Runtime.Extensions.Tests: https://dev.azure.com/dnceng-public/public/_build/results?buildId=456483&view=ms.vss-test-web.build-test-results-tab&runId=10276056&paneView=dotnet-dnceng.dnceng-build-release-tasks.helix-test-information-tab&resultId=150703

0:000> k 100
 # Child-SP          RetAddr               Call Site
00 0000fef0`13800010 0000aadc`1c64bcf8     System_Runtime_Extensions!S_P_CoreLib_System_Runtime_CompilerServices_ClassConstructorRunner_Cctor::GetCctor [/_/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/CompilerServices/ClassConstructorRunner.cs @ 286] 
01 0000fef0`13800010 0000aadc`1c64bcb0     System_Runtime_Extensions!S_P_CoreLib_System_Runtime_CompilerServices_ClassConstructorRunner::EnsureClassConstructorRun+0x38 [/_/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/CompilerServices/ClassConstructorRunner.cs @ 62] 
02 0000fef0`13800070 0000aadc`1c5f1d2c     System_Runtime_Extensions!S_P_CoreLib_System_Runtime_CompilerServices_ClassConstructorRunner::CheckStaticClassConstructionReturnThreadStaticBase+0x30 [/_/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/CompilerServices/ClassConstructorRunner.cs @ 49] 
03 0000fef0`13800090 0000aadc`1c5f15fc     System_Runtime_Extensions!S_P_CoreLib_System_Threading_Lock::TryEnterSlow+0x54c [/_/src/libraries/System.Private.CoreLib/src/System/Threading/Lock.cs @ 455] 
04 0000fef0`13800160 0000aadc`1c6a6e98     System_Runtime_Extensions!S_P_CoreLib_System_Threading_Lock::EnterAndGetCurrentThreadId+0x6c [/_/src/libraries/System.Private.CoreLib/src/System/Threading/Lock.cs @ 69] 
05 0000fef0`13800180 0000aadc`1c64bcf8     System_Runtime_Extensions!S_P_CoreLib_System_Runtime_CompilerServices_ClassConstructorRunner_Cctor::GetCctor+0x38 [/_/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/CompilerServices/ClassConstructorRunner.cs @ 286] 
06 0000fef0`138001e0 0000aadc`1c64bcb0     System_Runtime_Extensions!S_P_CoreLib_System_Runtime_CompilerServices_ClassConstructorRunner::EnsureClassConstructorRun+0x38 [/_/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/CompilerServices/ClassConstructorRunner.cs @ 62] 
07 0000fef0`13800240 0000aadc`1c5f1d2c     System_Runtime_Extensions!S_P_CoreLib_System_Runtime_CompilerServices_ClassConstructorRunner::CheckStaticClassConstructionReturnThreadStaticBase+0x30 [/_/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/CompilerServices/ClassConstructorRunner.cs @ 49] 
08 0000fef0`13800260 0000aadc`1c5f15fc     System_Runtime_Extensions!S_P_CoreLib_System_Threading_Lock::TryEnterSlow+0x54c [/_/src/libraries/System.Private.CoreLib/src/System/Threading/Lock.cs @ 455] 
09 0000fef0`13800330 0000aadc`1c6a6e98     System_Runtime_Extensions!S_P_CoreLib_System_Threading_Lock::EnterAndGetCurrentThreadId+0x6c [/_/src/libraries/System.Private.CoreLib/src/System/Threading/Lock.cs @ 69] 
0a 0000fef0`13800350 0000aadc`1c64bcf8     System_Runtime_Extensions!S_P_CoreLib_System_Runtime_CompilerServices_ClassConstructorRunner_Cctor::GetCctor+0x38 [/_/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/CompilerServices/ClassConstructorRunner.cs @ 286] 
0b 0000fef0`138003b0 0000aadc`1c64bcb0     System_Runtime_Extensions!S_P_CoreLib_System_Runtime_CompilerServices_ClassConstructorRunner::EnsureClassConstructorRun+0x38 [/_/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/CompilerServices/ClassConstructorRunner.cs @ 62] 
0c 0000fef0`13800410 0000aadc`1c5f1d2c     System_Runtime_Extensions!S_P_CoreLib_System_Runtime_CompilerServices_ClassConstructorRunner::CheckStaticClassConstructionReturnThreadStaticBase+0x30 [/_/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/CompilerServices/ClassConstructorRunner.cs @ 49] 
0d 0000fef0`13800430 0000aadc`1c5f15fc     System_Runtime_Extensions!S_P_CoreLib_System_Threading_Lock::TryEnterSlow+0x54c [/_/src/libraries/System.Private.CoreLib/src/System/Threading/Lock.cs @ 455] 
0e 0000fef0`13800500 0000aadc`1c6a6e98     System_Runtime_Extensions!S_P_CoreLib_System_Threading_Lock::EnterAndGetCurrentThreadId+0x6c [/_/src/libraries/System.Private.CoreLib/src/System/Threading/Lock.cs @ 69] 
0f 0000fef0`13800520 0000aadc`1c64bcf8     System_Runtime_Extensions!S_P_CoreLib_System_Runtime_CompilerServices_ClassConstructorRunner_Cctor::GetCctor+0x38 [/_/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/CompilerServices/ClassConstructorRunner.cs @ 286] 
10 0000fef0`13800580 0000aadc`1c64bcb0     System_Runtime_Extensions!S_P_CoreLib_System_Runtime_CompilerServices_ClassConstructorRunner::EnsureClassConstructorRun+0x38 [/_/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/CompilerServices/ClassConstructorRunner.cs @ 62] 
11 0000fef0`138005e0 0000aadc`1c5f1d2c     System_Runtime_Extensions!S_P_CoreLib_System_Runtime_CompilerServices_ClassConstructorRunner::CheckStaticClassConstructionReturnThreadStaticBase+0x30 [/_/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/CompilerServices/ClassConstructorRunner.cs @ 49] 
12 0000fef0`13800600 0000aadc`1c5f15fc     System_Runtime_Extensions!S_P_CoreLib_System_Threading_Lock::TryEnterSlow+0x54c [/_/src/libraries/System.Private.CoreLib/src/System/Threading/Lock.cs @ 455] 
13 0000fef0`138006d0 0000aadc`1c6a6e98     System_Runtime_Extensions!S_P_CoreLib_System_Threading_Lock::EnterAndGetCurrentThreadId+0x6c [/_/src/libraries/System.Private.CoreLib/src/System/Threading/Lock.cs @ 69] 
14 0000fef0`138006f0 0000aadc`1c64bcf8     System_Runtime_Extensions!S_P_CoreLib_System_Runtime_CompilerServices_ClassConstructorRunner_Cctor::GetCctor+0x38 [/_/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/CompilerServices/ClassConstructorRunner.cs @ 286] 
15 0000fef0`13800750 0000aadc`1c64bcb0     System_Runtime_Extensions!S_P_CoreLib_System_Runtime_CompilerServices_ClassConstructorRunner::EnsureClassConstructorRun+0x38 [/_/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/CompilerServices/ClassConstructorRunner.cs @ 62] 
16 0000fef0`138007b0 0000aadc`1c5f1d2c     System_Runtime_Extensions!S_P_CoreLib_System_Runtime_CompilerServices_ClassConstructorRunner::CheckStaticClassConstructionReturnThreadStaticBase+0x30 [/_/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/CompilerServices/ClassConstructorRunner.cs @ 49] 
17 0000fef0`138007d0 0000aadc`1c5f15fc     System_Runtime_Extensions!S_P_CoreLib_System_Threading_Lock::TryEnterSlow+0x54c [/_/src/libraries/System.Private.CoreLib/src/System/Threading/Lock.cs @ 455] 
18 0000fef0`138008a0 0000aadc`1c6a6e98     System_Runtime_Extensions!S_P_CoreLib_System_Threading_Lock::EnterAndGetCurrentThreadId+0x6c [/_/src/libraries/System.Private.CoreLib/src/System/Threading/Lock.cs @ 69] 
...

Known Issue Error Message

Fill the error message using step by step known issues guidance.

{
  "ErrorMessage": "",
  "ErrorPattern": "",
  "BuildRetry": false,
  "ExcludeConsoleLog": false
}

Report

Summary

24-Hour Hit Count 7-Day Hit Count 1-Month Count
0 0 0
@ghost ghost added the untriaged New issue has not been triaged by the area owner label Oct 31, 2023
@jkotas jkotas added area-System.Threading and removed untriaged New issue has not been triaged by the area owner area-NativeAOT-coreclr labels Oct 31, 2023
@ghost
Copy link

ghost commented Oct 31, 2023

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

Issue Details

log and dump for System.Runtime.Extensions.Tests: https://dev.azure.com/dnceng-public/public/_build/results?buildId=456483&view=ms.vss-test-web.build-test-results-tab&runId=10276056&paneView=dotnet-dnceng.dnceng-build-release-tasks.helix-test-information-tab&resultId=150703

0:000> k 100
 # Child-SP          RetAddr               Call Site
00 0000fef0`13800010 0000aadc`1c64bcf8     System_Runtime_Extensions!S_P_CoreLib_System_Runtime_CompilerServices_ClassConstructorRunner_Cctor::GetCctor [/_/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/CompilerServices/ClassConstructorRunner.cs @ 286] 
01 0000fef0`13800010 0000aadc`1c64bcb0     System_Runtime_Extensions!S_P_CoreLib_System_Runtime_CompilerServices_ClassConstructorRunner::EnsureClassConstructorRun+0x38 [/_/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/CompilerServices/ClassConstructorRunner.cs @ 62] 
02 0000fef0`13800070 0000aadc`1c5f1d2c     System_Runtime_Extensions!S_P_CoreLib_System_Runtime_CompilerServices_ClassConstructorRunner::CheckStaticClassConstructionReturnThreadStaticBase+0x30 [/_/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/CompilerServices/ClassConstructorRunner.cs @ 49] 
03 0000fef0`13800090 0000aadc`1c5f15fc     System_Runtime_Extensions!S_P_CoreLib_System_Threading_Lock::TryEnterSlow+0x54c [/_/src/libraries/System.Private.CoreLib/src/System/Threading/Lock.cs @ 455] 
04 0000fef0`13800160 0000aadc`1c6a6e98     System_Runtime_Extensions!S_P_CoreLib_System_Threading_Lock::EnterAndGetCurrentThreadId+0x6c [/_/src/libraries/System.Private.CoreLib/src/System/Threading/Lock.cs @ 69] 
05 0000fef0`13800180 0000aadc`1c64bcf8     System_Runtime_Extensions!S_P_CoreLib_System_Runtime_CompilerServices_ClassConstructorRunner_Cctor::GetCctor+0x38 [/_/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/CompilerServices/ClassConstructorRunner.cs @ 286] 
06 0000fef0`138001e0 0000aadc`1c64bcb0     System_Runtime_Extensions!S_P_CoreLib_System_Runtime_CompilerServices_ClassConstructorRunner::EnsureClassConstructorRun+0x38 [/_/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/CompilerServices/ClassConstructorRunner.cs @ 62] 
07 0000fef0`13800240 0000aadc`1c5f1d2c     System_Runtime_Extensions!S_P_CoreLib_System_Runtime_CompilerServices_ClassConstructorRunner::CheckStaticClassConstructionReturnThreadStaticBase+0x30 [/_/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/CompilerServices/ClassConstructorRunner.cs @ 49] 
08 0000fef0`13800260 0000aadc`1c5f15fc     System_Runtime_Extensions!S_P_CoreLib_System_Threading_Lock::TryEnterSlow+0x54c [/_/src/libraries/System.Private.CoreLib/src/System/Threading/Lock.cs @ 455] 
09 0000fef0`13800330 0000aadc`1c6a6e98     System_Runtime_Extensions!S_P_CoreLib_System_Threading_Lock::EnterAndGetCurrentThreadId+0x6c [/_/src/libraries/System.Private.CoreLib/src/System/Threading/Lock.cs @ 69] 
0a 0000fef0`13800350 0000aadc`1c64bcf8     System_Runtime_Extensions!S_P_CoreLib_System_Runtime_CompilerServices_ClassConstructorRunner_Cctor::GetCctor+0x38 [/_/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/CompilerServices/ClassConstructorRunner.cs @ 286] 
0b 0000fef0`138003b0 0000aadc`1c64bcb0     System_Runtime_Extensions!S_P_CoreLib_System_Runtime_CompilerServices_ClassConstructorRunner::EnsureClassConstructorRun+0x38 [/_/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/CompilerServices/ClassConstructorRunner.cs @ 62] 
0c 0000fef0`13800410 0000aadc`1c5f1d2c     System_Runtime_Extensions!S_P_CoreLib_System_Runtime_CompilerServices_ClassConstructorRunner::CheckStaticClassConstructionReturnThreadStaticBase+0x30 [/_/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/CompilerServices/ClassConstructorRunner.cs @ 49] 
0d 0000fef0`13800430 0000aadc`1c5f15fc     System_Runtime_Extensions!S_P_CoreLib_System_Threading_Lock::TryEnterSlow+0x54c [/_/src/libraries/System.Private.CoreLib/src/System/Threading/Lock.cs @ 455] 
0e 0000fef0`13800500 0000aadc`1c6a6e98     System_Runtime_Extensions!S_P_CoreLib_System_Threading_Lock::EnterAndGetCurrentThreadId+0x6c [/_/src/libraries/System.Private.CoreLib/src/System/Threading/Lock.cs @ 69] 
0f 0000fef0`13800520 0000aadc`1c64bcf8     System_Runtime_Extensions!S_P_CoreLib_System_Runtime_CompilerServices_ClassConstructorRunner_Cctor::GetCctor+0x38 [/_/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/CompilerServices/ClassConstructorRunner.cs @ 286] 
10 0000fef0`13800580 0000aadc`1c64bcb0     System_Runtime_Extensions!S_P_CoreLib_System_Runtime_CompilerServices_ClassConstructorRunner::EnsureClassConstructorRun+0x38 [/_/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/CompilerServices/ClassConstructorRunner.cs @ 62] 
11 0000fef0`138005e0 0000aadc`1c5f1d2c     System_Runtime_Extensions!S_P_CoreLib_System_Runtime_CompilerServices_ClassConstructorRunner::CheckStaticClassConstructionReturnThreadStaticBase+0x30 [/_/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/CompilerServices/ClassConstructorRunner.cs @ 49] 
12 0000fef0`13800600 0000aadc`1c5f15fc     System_Runtime_Extensions!S_P_CoreLib_System_Threading_Lock::TryEnterSlow+0x54c [/_/src/libraries/System.Private.CoreLib/src/System/Threading/Lock.cs @ 455] 
13 0000fef0`138006d0 0000aadc`1c6a6e98     System_Runtime_Extensions!S_P_CoreLib_System_Threading_Lock::EnterAndGetCurrentThreadId+0x6c [/_/src/libraries/System.Private.CoreLib/src/System/Threading/Lock.cs @ 69] 
14 0000fef0`138006f0 0000aadc`1c64bcf8     System_Runtime_Extensions!S_P_CoreLib_System_Runtime_CompilerServices_ClassConstructorRunner_Cctor::GetCctor+0x38 [/_/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/CompilerServices/ClassConstructorRunner.cs @ 286] 
15 0000fef0`13800750 0000aadc`1c64bcb0     System_Runtime_Extensions!S_P_CoreLib_System_Runtime_CompilerServices_ClassConstructorRunner::EnsureClassConstructorRun+0x38 [/_/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/CompilerServices/ClassConstructorRunner.cs @ 62] 
16 0000fef0`138007b0 0000aadc`1c5f1d2c     System_Runtime_Extensions!S_P_CoreLib_System_Runtime_CompilerServices_ClassConstructorRunner::CheckStaticClassConstructionReturnThreadStaticBase+0x30 [/_/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/CompilerServices/ClassConstructorRunner.cs @ 49] 
17 0000fef0`138007d0 0000aadc`1c5f15fc     System_Runtime_Extensions!S_P_CoreLib_System_Threading_Lock::TryEnterSlow+0x54c [/_/src/libraries/System.Private.CoreLib/src/System/Threading/Lock.cs @ 455] 
18 0000fef0`138008a0 0000aadc`1c6a6e98     System_Runtime_Extensions!S_P_CoreLib_System_Threading_Lock::EnterAndGetCurrentThreadId+0x6c [/_/src/libraries/System.Private.CoreLib/src/System/Threading/Lock.cs @ 69] 
...
Author: jkotas
Assignees: -
Labels:

area-NativeAOT-coreclr

Milestone: -

@jkotas jkotas added the blocking-clean-ci Blocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms' label Oct 31, 2023
@jkotas
Copy link
Member Author

jkotas commented Oct 31, 2023

cc @kouvel

@jkotas
Copy link
Member Author

jkotas commented Oct 31, 2023

Introduced by #87672

@kouvel kouvel self-assigned this Oct 31, 2023
@kouvel kouvel added this to the 9.0.0 milestone Oct 31, 2023
kouvel added a commit to kouvel/runtime that referenced this issue Oct 31, 2023
- The `Monitor` type was being constructed due to the use of `Monitor.DebugBlockingScope`, added that to the initialization phase
- If necessary, an alternative may be to move `DebugBlockingScope` to be under `Lock`. Based on the comments the thread-static field is apparently bound-to in debugging scenarios.
- Fixes dotnet#94227
@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Oct 31, 2023
jkotas pushed a commit that referenced this issue Nov 1, 2023
* Fix class construction recursion issue in `Lock` on NativeAOT

- The `Monitor` type was being constructed due to the use of `Monitor.DebugBlockingScope`, added that to the initialization phase
- If necessary, an alternative may be to move `DebugBlockingScope` to be under `Lock`. Based on the comments the thread-static field is apparently bound-to in debugging scenarios.
- Fixes #94227

* Remove `DebugBlockingScope` instead
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Nov 1, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Dec 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Threading blocking-clean-ci Blocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms'
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants