A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/dotnet/yarp/issues/1770 below:

WebSockets not closed gracefully · Issue #1770 · dotnet/yarp · GitHub

Describe the bug

After the client and server have exchanged graceful WS Close messages, YARP isn't gracefully closing the connection. After a few seconds the client times out and closes the connection. This causes the client (E.g. Chrome) to report a WS error (1006) rather than a graceful close (1000).

To Reproduce
  1. Create a WebSocket connection through YARP
  2. Close it gracefully from both sides
  3. Observe a multi-second pause and then the client disconnects and may report an error

This reproduces with YARP running on Kestrel, HttpSys, and IIS Express. The client can be chrome, edge or even HttpClient, though that doesn't report an error.

It also reproduces in our WebSocket functional tests, causing them to take 1s or longer, vs a few ms when I tell YARP to cancel the request read.
https://github.com/microsoft/reverse-proxy/blob/b9f43dd4b383e7c2e1b222c0dd6587a848d88a56/test/ReverseProxy.FunctionalTests/WebSocketTests.cs#L26

I think the problem is here:
https://github.com/microsoft/reverse-proxy/blob/b9f43dd4b383e7c2e1b222c0dd6587a848d88a56/src/ReverseProxy/Forwarder/HttpForwarder.cs#L593

After the client and destination have exchanged close messages the destination closes the connection. YARP sees the response copy complete, but then waits for the request side to be closed from the client. Instead it should cancel the ongoing read.

Further technical details

Version: 1.1
Reported by an internal partner

Recommend we patch this in 1.1


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4