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 - System.NullReferenceException in System.Threading.Lock.TryInitializeStatics #94728

Closed
jkotas opened this issue Nov 14, 2023 · 2 comments · Fixed by #94873
Closed
Assignees
Labels
area-System.Threading blocking-clean-ci Blocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms' Known Build Error Use this to report build issues in the .NET Helix tab
Milestone

Comments

@jkotas
Copy link
Member

jkotas commented Nov 14, 2023

Running assembly:System.Net.HttpListener.Tests, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
Process terminated. Exception thrown from SocketAsyncEngine event loop: System.TypeInitializationException: A type initializer threw an exception. To determine which type, inspect the InnerException's StackTrace property.
 ---> System.TypeInitializationException: A type initializer threw an exception. To determine which type, inspect the InnerException's StackTrace property.
 ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at System.Threading.Lock.TryInitializeStatics() + 0xf8
   at System.Threading.Lock.TryEnterSlow(Int32, Lock.ThreadId) + 0x16c
   at System.Threading.Lock.EnterAndGetCurrentThreadId() + 0x68
   at System.Runtime.CompilerServices.ClassConstructorRunner.Cctor.GetCctor(StaticClassConstructionContext*) + 0x38
   at System.Runtime.CompilerServices.ClassConstructorRunner.EnsureClassConstructorRun(StaticClassConstructionContext*) + 0x38
   at System.Runtime.CompilerServices.ClassConstructorRunner.CheckStaticClassConstructionReturnGCStaticBase(StaticClassConstructionContext*, Object) + 0x14
   at System.Diagnostics.Tracing.NativeRuntimeEventSource..cctor() + 0x58
   at System.Runtime.CompilerServices.ClassConstructorRunner.EnsureClassConstructorRun(StaticClassConstructionContext*) + 0xc8
   --- End of inner exception stack trace ---
   at System.Runtime.CompilerServices.ClassConstructorRunner.EnsureClassConstructorRun(StaticClassConstructionContext*) + 0x15c
   at System.Runtime.CompilerServices.ClassConstructorRunner.CheckStaticClassConstructionReturnGCStaticBase(StaticClassConstructionContext*, Object) + 0x14
   at System.Threading.PortableThreadPool..ctor() + 0x1b0
   at System.Threading.PortableThreadPool..cctor() + 0x68
   at System.Runtime.CompilerServices.ClassConstructorRunner.EnsureClassConstructorRun(StaticClassConstructionContext*) + 0xc8
   --- End of inner exception stack trace ---
   at System.Runtime.CompilerServices.ClassConstructorRunner.EnsureClassConstructorRun(StaticClassConstructionContext*) + 0x15c
   at System.Runtime.CompilerServices.ClassConstructorRunner.CheckStaticClassConstructionReturnGCStaticBase(StaticClassConstructionContext*, Object) + 0x14
   at System.Threading.ThreadPoolWorkQueue.Enqueue(Object, Boolean) + 0x140
   at System.Threading.ThreadPool.UnsafeQueueUserWorkItem(IThreadPoolWorkItem, Boolean) + 0x60
   at System.Net.Sockets.SocketAsyncEngine.EventLoop() + 0xc4
   at System.RuntimeExceptionHelpers.FailFast(String, Exception, String, RhFailFastReason, IntPtr, IntPtr) + 0x180
   at System.Net.Sockets.SocketAsyncEngine.EventLoop() + 0x160
   at System.Runtime.EH.DispatchEx(StackFrameIterator&, EH.ExInfo&) + 0x204
   at System.Runtime.EH.RhThrowEx(Object, EH.ExInfo&) + 0x44
   at System.Threading.Thread.StartThread(IntPtr) + 0x154

Build Information

Build: https://dev.azure.com/dnceng-public/cbb18261-c48f-4abb-8651-8cdcb5474649/_build/results?buildId=468884
Build error leg or test failing: System.Net.HttpListener.Tests.WorkItemExecution
Pull request: #94692

Error Message

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

{
  "ErrorMessage": "System.Threading.Lock.TryInitializeStatics",
  "ErrorPattern": "",
  "BuildRetry": false,
  "ExcludeConsoleLog": false
}

Known issue validation

Build: 🔎 https://dev.azure.com/dnceng-public/public/_build/results?buildId=468884
Error message validated: System.Threading.Lock.TryInitializeStatics
Result validation: ✅ Known issue matched with the provided build.
Validation performed at: 11/14/2023 6:27:46 PM UTC

Report

Build Definition Test Pull Request
531213 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #97062
531121 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #97075
530911 dotnet/runtime Microsoft.Extensions.FileProviders.Physical.Tests.WorkItemExecution
530962 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #97114
530971 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #97080
530810 dotnet/runtime System.Formats.Tar.Tests.WorkItemExecution #97062
530819 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #97104
530811 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #97052
530826 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution
530592 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #96841
530528 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #90505
530404 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #96386
530373 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #97087
530327 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #96354
529245 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #90505
530151 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #97096
530144 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #96974
2355601 dotnet-runtime Device Startup - iOS NativeAOT HelloWorld nollvm nosymbols HybridGlobalization.WorkItemExecution
530041 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #97087
529935 dotnet/runtime System.IO.Tests.WorkItemExecution
529924 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #97079
529691 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #97068
529669 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #97058
529552 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #95980
529539 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #96995
529444 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #97058
529413 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #97055
529298 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #96890
529173 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #96386
528933 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #94764
528672 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #96896
528657 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #96841
528612 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #96678
528493 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #96974
528295 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution
528343 dotnet/runtime System.IO.FileSystem.Tests.WorkItemExecution #96888
528270 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #94764
528225 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #97017
528183 dotnet/runtime System.IO.FileSystem.Tests.WorkItemExecution #96805
528007 dotnet/runtime JIT.CodeGenBringUpTests.WorkItemExecution
528035 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #96982
528027 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #96983
527919 dotnet/runtime JIT.CodeGenBringUpTests.WorkItemExecution #96982
527994 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #97005
527889 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #94764
527849 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #96995
527816 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #96201
527706 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #96992
527644 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #96991
527576 dotnet/runtime nativeaot/SmokeTests/Reflection/Reflection_FromUsage/Reflection_FromUsage.sh #96678
527456 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #96676
527428 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #96985
527361 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #96969
527355 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #96983
527210 dotnet/runtime System.Web.HttpUtility.Tests.WorkItemExecution
527253 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #96741
527177 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #96969
527171 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #96894
527165 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution
526886 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution
526876 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution
526833 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #96927
526822 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #96960
526766 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #96896
526623 dotnet/runtime System.Threading.Tasks.Dataflow.Tests.WorkItemExecution
526521 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #96926
526484 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #96794
526474 dotnet/runtime Microsoft.Extensions.Options.Tests.WorkItemExecution
526396 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #96890
526349 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #96896
526289 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #96676
526254 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #95904
526165 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #96936
526144 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #96933
526132 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #96931
525957 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #96927
525923 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #96926
525906 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #96877
525842 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #96924
525667 dotnet/runtime JIT.CodeGenBringUpTests.WorkItemExecution
525785 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #96913
525765 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #96921
525420 dotnet/runtime Microsoft.Extensions.Configuration.Xml.Tests.WorkItemExecution #96906
525477 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #96805
525402 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #96902
525362 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #96880
525344 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #96741
525261 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #96678
525140 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #96676
525105 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #95904
525086 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #96893
524959 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #96558
524821 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution
524798 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution
524790 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #95583
524255 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #96829
524273 dotnet/runtime System.Net.Primitives.Pal.Tests.WorkItemExecution
524311 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #96870
524291 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #96867
524168 dotnet/runtime nativeaot.SmokeTests.WorkItemExecution #96805
Displaying 100 of 215 results

Summary

24-Hour Hit Count 7-Day Hit Count 1-Month Count
23 112 215
@jkotas jkotas added blocking-clean-ci Blocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms' Known Build Error Use this to report build issues in the .NET Helix tab labels Nov 14, 2023
@dotnet-issue-labeler dotnet-issue-labeler bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Nov 14, 2023
@ghost ghost added the untriaged New issue has not been triaged by the area owner label Nov 14, 2023
@jkotas jkotas added area-System.Threading and removed untriaged New issue has not been triaged by the area owner needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Nov 14, 2023
@ghost
Copy link

ghost commented Nov 14, 2023

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

Issue Details
Running assembly:System.Net.HttpListener.Tests, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
Process terminated. Exception thrown from SocketAsyncEngine event loop: System.TypeInitializationException: A type initializer threw an exception. To determine which type, inspect the InnerException's StackTrace property.
 ---> System.TypeInitializationException: A type initializer threw an exception. To determine which type, inspect the InnerException's StackTrace property.
 ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at System.Threading.Lock.TryInitializeStatics() + 0xf8
   at System.Threading.Lock.TryEnterSlow(Int32, Lock.ThreadId) + 0x16c
   at System.Threading.Lock.EnterAndGetCurrentThreadId() + 0x68
   at System.Runtime.CompilerServices.ClassConstructorRunner.Cctor.GetCctor(StaticClassConstructionContext*) + 0x38
   at System.Runtime.CompilerServices.ClassConstructorRunner.EnsureClassConstructorRun(StaticClassConstructionContext*) + 0x38
   at System.Runtime.CompilerServices.ClassConstructorRunner.CheckStaticClassConstructionReturnGCStaticBase(StaticClassConstructionContext*, Object) + 0x14
   at System.Diagnostics.Tracing.NativeRuntimeEventSource..cctor() + 0x58
   at System.Runtime.CompilerServices.ClassConstructorRunner.EnsureClassConstructorRun(StaticClassConstructionContext*) + 0xc8
   --- End of inner exception stack trace ---
   at System.Runtime.CompilerServices.ClassConstructorRunner.EnsureClassConstructorRun(StaticClassConstructionContext*) + 0x15c
   at System.Runtime.CompilerServices.ClassConstructorRunner.CheckStaticClassConstructionReturnGCStaticBase(StaticClassConstructionContext*, Object) + 0x14
   at System.Threading.PortableThreadPool..ctor() + 0x1b0
   at System.Threading.PortableThreadPool..cctor() + 0x68
   at System.Runtime.CompilerServices.ClassConstructorRunner.EnsureClassConstructorRun(StaticClassConstructionContext*) + 0xc8
   --- End of inner exception stack trace ---
   at System.Runtime.CompilerServices.ClassConstructorRunner.EnsureClassConstructorRun(StaticClassConstructionContext*) + 0x15c
   at System.Runtime.CompilerServices.ClassConstructorRunner.CheckStaticClassConstructionReturnGCStaticBase(StaticClassConstructionContext*, Object) + 0x14
   at System.Threading.ThreadPoolWorkQueue.Enqueue(Object, Boolean) + 0x140
   at System.Threading.ThreadPool.UnsafeQueueUserWorkItem(IThreadPoolWorkItem, Boolean) + 0x60
   at System.Net.Sockets.SocketAsyncEngine.EventLoop() + 0xc4
   at System.RuntimeExceptionHelpers.FailFast(String, Exception, String, RhFailFastReason, IntPtr, IntPtr) + 0x180
   at System.Net.Sockets.SocketAsyncEngine.EventLoop() + 0x160
   at System.Runtime.EH.DispatchEx(StackFrameIterator&, EH.ExInfo&) + 0x204
   at System.Runtime.EH.RhThrowEx(Object, EH.ExInfo&) + 0x44
   at System.Threading.Thread.StartThread(IntPtr) + 0x154

Build Information

Build: https://dev.azure.com/dnceng-public/cbb18261-c48f-4abb-8651-8cdcb5474649/_build/results?buildId=468884
Build error leg or test failing: System.Net.HttpListener.Tests.WorkItemExecution
Pull request: #94692

Error Message

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

{
  "ErrorMessage": "System.Threading.Lock.TryInitializeStatics",
  "ErrorPattern": "",
  "BuildRetry": false,
  "ExcludeConsoleLog": false
}
Author: jkotas
Assignees: -
Labels:

area-System.Threading, blocking-clean-ci, Known Build Error

Milestone: -

@jkotas
Copy link
Member Author

jkotas commented Nov 14, 2023

@kouvel Could you please take a look?

@jkotas jkotas changed the title Test failure due System.NullReferenceException in System.Threading.Lock.TryInitializeStatics Test failure - System.NullReferenceException in System.Threading.Lock.TryInitializeStatics Nov 14, 2023
@kouvel kouvel self-assigned this Nov 14, 2023
@kouvel kouvel added this to the 9.0.0 milestone Nov 14, 2023
@build-analysis build-analysis bot removed this from the 9.0.0 milestone Nov 15, 2023
@ghost ghost added the untriaged New issue has not been triaged by the area owner label Nov 15, 2023
@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Nov 16, 2023
@kouvel kouvel removed the untriaged New issue has not been triaged by the area owner label Nov 21, 2023
@kouvel kouvel added this to the 9.0.0 milestone Nov 21, 2023
kouvel added a commit to kouvel/runtime that referenced this issue Jan 17, 2024
…sive accesses during its own class construction

- `NativeRuntimeEventSource.Log` can be null if it's being constructed in the same thread earlier in the stack, added null checks

Fixes dotnet#94728
@ghost ghost added in-pr There is an active PR which will close this issue when it is merged and removed in-pr There is an active PR which will close this issue when it is merged labels Jan 17, 2024
kouvel added a commit that referenced this issue Jan 18, 2024
…nt for recursive accesses during its own class construction (#94873)

* Fix Lock's usage of NativeRuntimeEventSource.Log to account for recursive accesses during its own class construction

- `NativeRuntimeEventSource.Log` can be null if it's being constructed in the same thread earlier in the stack, added null checks

Fixes #94728
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Jan 18, 2024
tmds pushed a commit to tmds/runtime that referenced this issue Jan 23, 2024
…nt for recursive accesses during its own class construction (dotnet#94873)

* Fix Lock's usage of NativeRuntimeEventSource.Log to account for recursive accesses during its own class construction

- `NativeRuntimeEventSource.Log` can be null if it's being constructed in the same thread earlier in the stack, added null checks

Fixes dotnet#94728
@github-actions github-actions bot locked and limited conversation to collaborators Feb 17, 2024
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' Known Build Error Use this to report build issues in the .NET Helix tab
Projects
None yet
2 participants