0

I have an ASP.NET Core 9 application running as a service. After the latest upgrades of nuget packages, the application crashes periodically with a StackOverflow exception:

Event Viewer Report

I tried to reproduce it, but I couldn't. So I attached the Visual Studio debugger and let it run until it happened again.

The call stack does not touch any application code and looks confined into System.Private.CoreLib.DLL

[Managed to Native Transition]
System.Private.CoreLib.dll!Interop.Advapi32.EventWriteTransfer(long registrationHandle, System.Diagnostics.Tracing.EventDescriptor eventDescriptor, System.Guid* activityId, System.Guid* relatedActivityId, int userDataCount, System.Diagnostics.Tracing.EventProvider.EventData* userData) Line 3853
    at -\Interop.cs(3853)
System.Private.CoreLib.dll!System.Diagnostics.Tracing.EventSource.WriteEventWithRelatedActivityIdCore(int eventId, System.Guid* relatedActivityId, int eventDataCount, System.Diagnostics.Tracing.EventSource.EventData* data) Line 1126
    at System.Diagnostics.Tracing\EventSource.cs(1126)
System.Private.CoreLib.dll!System.Diagnostics.Tracing.EventSource.WriteEvent(int eventId, int arg1, int arg2) Line 681
    at System.Diagnostics.Tracing\EventSource.cs(681)
System.Private.CoreLib.dll!System.Threading.Tasks.Task.FinishStageTwo() Line 2154
    at System.Threading.Tasks\Task.cs(2154)
System.Private.CoreLib.dll!System.Threading.Tasks.Task.ProcessChildCompletion(System.Threading.Tasks.Task childTask) Line 2210
    at System.Threading.Tasks\Task.cs(2210)
System.Private.CoreLib.dll!System.Threading.Tasks.Task.FinishStageTwo() Line 2166
    at System.Threading.Tasks\Task.cs(2166)
[The 2 frame(s) above this were repeated 6033 times]
System.Private.CoreLib.dll!System.Threading.Tasks.Task.ProcessChildCompletion(System.Threading.Tasks.Task childTask) Line 2210
    at System.Threading.Tasks\Task.cs(2210)
System.Private.CoreLib.dll!System.Threading.Tasks.Task.FinishStageTwo() Line 2166
    at System.Threading.Tasks\Task.cs(2166)
System.Private.CoreLib.dll!System.Threading.Tasks.Task.ProcessChildCompletion(System.Threading.Tasks.Task childTask) Line 2210
    at System.Threading.Tasks\Task.cs(2210)
System.Private.CoreLib.dll!System.Threading.Tasks.Task.FinishStageTwo() Line 2166
    at System.Threading.Tasks\Task.cs(2166)
System.Private.CoreLib.dll!System.Threading.Tasks.Task.ProcessChildCompletion(System.Threading.Tasks.Task childTask) Line 2210
    at System.Threading.Tasks\Task.cs(2210)
System.Private.CoreLib.dll!System.Threading.Tasks.Task.FinishStageTwo() Line 2166
    at System.Threading.Tasks\Task.cs(2166)
System.Private.CoreLib.dll!System.Threading.Tasks.Task.ProcessChildCompletion(System.Threading.Tasks.Task childTask) Line 2210
    at System.Threading.Tasks\Task.cs(2210)
System.Private.CoreLib.dll!System.Threading.Tasks.Task.FinishStageTwo() Line 2166
    at System.Threading.Tasks\Task.cs(2166)
.
.
.
.
.
.
.
.
    at System.Threading.Tasks\Task.cs(2210)
System.Private.CoreLib.dll!System.Threading.Tasks.Task.FinishStageTwo() Line 2166
    at System.Threading.Tasks\Task.cs(2166)
System.Private.CoreLib.dll!System.Threading.Tasks.Task.ProcessChildCompletion(System.Threading.Tasks.Task childTask) Line 2210
    at System.Threading.Tasks\Task.cs(2210)
System.Private.CoreLib.dll!System.Threading.Tasks.Task.FinishStageTwo() Line 2166
    at System.Threading.Tasks\Task.cs(2166)
System.Private.CoreLib.dll!System.Threading.Tasks.Task.ProcessChildCompletion(System.Threading.Tasks.Task childTask) Line 2210
    at System.Threading.Tasks\Task.cs(2210)
System.Private.CoreLib.dll!System.Threading.Tasks.Task.FinishStageTwo() Line 2166
    at System.Threading.Tasks\Task.cs(2166)
System.Private.CoreLib.dll!System.Threading.Tasks.Task.ProcessChildCompletion(System.Threading.Tasks.Task childTask) Line 2210
    at System.Threading.Tasks\Task.cs(2210)
System.Private.CoreLib.dll!System.Threading.Tasks.Task.FinishStageTwo() Line 2166
    at System.Threading.Tasks\Task.cs(2166)
System.Private.CoreLib.dll!System.Threading.Tasks.Task.FinishSlow(bool userDelegateExecute) Line 2098
    at System.Threading.Tasks\Task.cs(2098)
System.Private.CoreLib.dll!System.Threading.Tasks.Task.ExecuteWithThreadLocal(ref System.Threading.Tasks.Task currentTaskSlot, System.Threading.Thread threadPoolThread) Line 2328
    at System.Threading.Tasks\Task.cs(2328)
System.Private.CoreLib.dll!System.Threading.ThreadPoolWorkQueue.Dispatch() Line 789
    at System.Threading\ThreadPoolWorkQueue.cs(789)
System.Private.CoreLib.dll!System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart() Line 1175
    at System.Threading\PortableThreadPool.cs(1175)

This is the Visual studio screen when the error occurs:

Visual Studio Debug Screen

A bug in github for this issue has been created, but I wish to replicate it here hoping to shorten the time of a solution, as it looks quite critical and concerning.

UPDATE

Waiting for someone on the .NET Team to have a look at this issue, I had to do something to avoid the crash (https://github.com/dotnet/runtime/pull/113407)

0

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.