Skip to content

[ARM][.NET 7] - System.ArgumentOutOfRangeException on ThreadPool ctor #51550

@tiaraju

Description

@tiaraju

Description

Hi there!

We're running our system in a .NET 7 (more specifically, 7.0.12,) Linux env, and, when changing to use ARM instances, we noticed an unusual behavior where the instances started crashing.

We were unable to pinpoint a cause for that. It happens quite constantly. For a service running with 120 instances, we would have at least 5 instances unhealthy at a single point in time. For the time being, we didn't find anything to trigger this crash.
The exception we see in the logs is the following one:

Unhandled exception. System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. (Parameter 'state')
   at System.Threading.ThreadPool.<>c.<.cctor>b__78_0(Object state)
   at System.Net.Sockets.SocketAsyncEngine.System.Threading.IThreadPoolWorkItem.Execute()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()

We've also noticed that this problem was reported in #84407 and solved in version 7.0.7, PR #84641. Nevertheless, we still noticed it happening when using ARM.
When running with AMD, we didn't notice the same behavior.

Do you have any idea about what may be causing that?
Thanks!

Reproduction Steps

Running a .NET 7.0.12 Web API, using docker on top of AWS EC2 Linux image.

Expected behavior

We expect to see no crashes on the SocketAsyncEngine, as mentioned in the exception above

Actual behavior

Currently, running a service with ~ 120 instances, at a certain point in time, some instances start to crash with the following exception message

Unhandled exception. System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. (Parameter 'state')
   at System.Threading.ThreadPool.<>c.<.cctor>b__78_0(Object state)
   at System.Net.Sockets.SocketAsyncEngine.System.Threading.IThreadPoolWorkItem.Execute()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()

Regression?

No response

Known Workarounds

No response

Configuration

We're running a .NET 7.0.12 web API
We are using the docker image available at mcr.microsoft.com/dotnet/aspnet:7.0
Running on a Debian GNU/Linux 11 (bullseye)

Other information

No response

Metadata

Metadata

Assignees

Labels

area-networkingIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions