dotnet / dotnet/aspnetcore

Kestrel will not accept new connection.

Open
#55,599 9 comments 1 reaction 0 assignees View on GitHub
area-networking
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 10h
Merged PRs (30d)
281

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Describe the bug

send request to Kestrel server on Linux get an error: connection reset by peer.
netstat shows TCP Connection status is Listening, Recv-Q is 257 and no changes in long term.

in TCP Listening status, Recv-Q means **how many connection wait for accept**.

memory dump information shows:
![image](https://github.com/dotnet/aspnetcore/assets/521283/00aa6941-19c9-4567-9846-0cd8dca1d2e9)

`TransportManager._transports[0].AcceptLoopTask.Status` is RanToCompletion.

`TransportManager._transports` is the transport collection of endpoint binding.

diagnosis source code:

in this code will set AcceptLoopTask.Status to RanToCompletion:
https://github.com/dotnet/aspnetcore/blob/d6f154cca3863703cf87c8b840eea9cbe20229b2/src/Servers/Kestrel/Core/src/Internal/ConnectionDispatcher.cs#L74

and when this Task completed( break from accept loop ). Kestrel will **not** accept any connection, looks like go hibernation.

and **not found critical error log in log file**.
so, it's not breaking in
https://github.com/dotnet/aspnetcore/blob/d6f154cca3863703cf87c8b840eea9cbe20229b2/src/Servers/Kestrel/Core/src/Internal/ConnectionDispatcher.cs#L70

The presumed path is:
https://github.com/dotnet/aspnetcore/blob/d6f154cca3863703cf87c8b840eea9cbe20229b2/src/Servers/Kestrel/Core/src/Internal/ConnectionDispatcher.cs#L51

whatever,

There is possible of go out from **accept loop** and not quit or crush.

### Expected Behavior

_No response_

### Steps To Reproduce

_No response_

### Exceptions (if any)

_No response_

### .NET Version

dotnet 6.0.16

### Anything else?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.