dotnet / dotnet/aspnetcore

Websocket .net core detect when client looses internet connectivity

Open
#40,612 1 comment 0 reactions 0 assignees View on GitHub
area-networking investigate
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 6h
Merged PRs (30d)
290

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Describe the bug

Hi all,
sorry to ask again about: [https://github.com/dotnet/AspNetCore.Docs/issues/9053](https://github.com/dotnet/AspNetCore.Docs/issues/9053) , but I'm experiencing the following scenario

1. if for any reason I got a primary issue in Layer 3 core switches or maintenance I got mor or less 2.5K websocket clients disappearing at once.
2. even if we deployed a ws PING/PONG strategy with 60 seconds timeout, the application server (.Net 6 linux) is unresponsive and begin starving, even NLOG traces are interrupted, but the process is not crashing (and maybe a crash will raise a systemd restart)
3. with lesser connections (about 500 - 800) the application come back to life after 90 seconds and begin tracing again all forced disconnect plus emitting ton of exceptions (up to 20k)

Thanks in advance for your feedback
Diego

### Expected Behavior

the expected behavior is not starving, the application should resume closing and accepting again connections

**another interesting note:** in the test dev lab we discarded httplistenser websocket and we tried the obsolete: https://github.com/statianzo/Fleck , Fleck is behaving better we got disconnections on timeout, without starvation.

### Steps To Reproduce

- Just use [websocket sample](https://github.com/dotnet/AspNetCore.Docs/tree/main/aspnetcore/fundamentals/websockets/samples/6.x/WebSocketsSample)
- add an healtchek API 20 seconds poll via postman
- create a couple of clients with 2000 thread
- when reached 3 - 4 k connections serverside - KILL the process client - (close socket are not sent)
- in the meanwhile keep postman on healthchek

the healthcheck will stuck

### Exceptions (if any)

exceptions arte not thown in the app,
but donet counters are mesuring tons of internal eceptions

### .NET Version

6.0

### 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.