-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ClientWebsocket KeepAliveInterval keeps spawning more keep alive messages in some cases #69684
Comments
Tagging subscribers to this area: @dotnet/ncl Issue DetailsDescriptionCreating a websocket connection to a websocket server with the KeepAliveInterval option set will start sending increasingly more ping message over time, resulting in using more and more network capacity. Maybe related: #65998, another KeepAliveInterval issue Reproduction StepsCreate a ClientWebSocket, connect to server and watch network usage. See gist and wireshark logs. Gist to reproduce: https://gist.github.com/JKorf/0c7789dce19e3639ece83db737c227a0 Wireshark logs: keepalive-full.zip Expected behaviorThe KeepAliveInterval should correctly send 1 ping message per timestamp, no more Actual behaviorIncreasingly more ping messages are send, eating up all network Regression?No response Known WorkaroundsSetting KeepAliveInterval to TimeSpan.Zero will fix the issue, network usage is stable. ConfigurationDotnet 6 Other informationNo response
|
Thanks for the repro, @JKorf. However, as I've suspected, and it's the server which is spamming us with PINGs -- and per protocol, we have to respond. Nothing we can do about it, sorry. Closing. some logs...
P.S.:
This is interesting, it seems that the server is reacting strangely to receiving unsolicited PONG -- even though it is perfectly valid per RFC https://datatracker.ietf.org/doc/html/rfc6455#section-5.5.3. I suggest raising an issue to the server, if it's possible. P.P.S.: Linking other issue, that may allow to change from unsolicited PONG to PING-PONG behavior just in case... #48729 |
Description
Creating a websocket connection to a websocket server with the KeepAliveInterval option set will start sending increasingly more ping message over time, resulting in using more and more network capacity.
Even though the amount of messages can be very low, the network usage will increase to use up multiple mbits of up/download speed, while nothing is being actively send and receive is only a few bytes every second.
A lower KeepAliveInterval, say 1 second, will show the issue faster, though it is also present at intervals of 1 minutes.
Maybe related: #65998, another KeepAliveInterval issue
Reproduction Steps
Create a ClientWebSocket, connect to server and watch network usage. See gist and wireshark logs. Issue is not present on all server implementations
Gist to reproduce: https://gist.github.com/JKorf/0c7789dce19e3639ece83db737c227a0
Wireshark logs: keepalive-full.zip
Expected behavior
The KeepAliveInterval should correctly send 1 ping message per timestamp, no more
Actual behavior
Increasingly more ping messages are send, eating up all network
Regression?
No response
Known Workarounds
Setting KeepAliveInterval to TimeSpan.Zero will fix the issue, network usage is stable.
Configuration
Dotnet 6
Windows 10,
x64
Other information
No response
The text was updated successfully, but these errors were encountered: