Skip to content
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

OnDisconnected issue on Raspberry Pi/NET 6 #372

Open
ssliwa-prunus opened this issue Apr 13, 2024 · 3 comments
Open

OnDisconnected issue on Raspberry Pi/NET 6 #372

ssliwa-prunus opened this issue Apr 13, 2024 · 3 comments

Comments

@ssliwa-prunus
Copy link

Hi,

on Raspberry Pi 4 , Arch64, Linux Debian 11, .NET 6, we have a problem with getting rise OnDisconnected event.
Steps to reproduce

  1. start application with disconnected network cable
  2. plug in network cable -> OnConnected event rise on about 3sec, that is OK
  3. unplug network cable -> OnDisconnected event rise after about 18 minutes, that is NOK

On Windows 10 and Windows WSL (Debian) it seems to works fine.
Did you meet such a problem? Do you have any suggestions what is wrong with it?

Thanks for any help.

@doghappy
Copy link
Owner

The issue can be reproduced.

  1. create an ARMx64 VM on Azure.
  2. drop a ip rule from iptables

logs:

04/18/2024 14:27:02 OnPong: 00:00:00.0000438
04/18/2024 14:27:07 Ping
04/18/2024 14:27:07 OnPong: 00:00:00.0000423
04/18/2024 14:27:12 Ping
04/18/2024 14:27:12 OnPong: 00:00:00.0000620
04/18/2024 14:27:18 Ping
04/18/2024 14:27:18 OnPong: 00:00:00.0000721
04/18/2024 14:44:48 Disconnected
04/18/2024 14:45:09 OnReconnectAttempt: 1
04/18/2024 14:45:30 OnReconnectAttempt: 2
04/18/2024 14:45:51 OnReconnectAttempt: 3
04/18/2024 14:46:12 OnReconnectAttempt: 4
04/18/2024 14:46:33 OnReconnectAttempt: 5
04/18/2024 14:46:54 OnReconnectAttempt: 6
04/18/2024 14:47:15 OnReconnectAttempt: 7
04/18/2024 14:47:36 OnReconnectAttempt: 8

it takes 17 mins to get Disconnected event.

@doghappy
Copy link
Owner

The issue is not limited to ARM devices; it also occurs on Ubuntu x64. Because the TCP connection is not properly closed, different operating systems have different implementations, resulting in different TCP configurations.

I attempted to reproduce the issue by using the ClientWebSocket class in C# to directly connect to a WebSocket server and then dropping the connection from iptables.

Even after switching to Node.js, the disconnection may not be 'immediately' detected.

Interestingly, when I allowed access to the WebSocket server in iptables, the connection immediately resumed as if the network had not been disconnected.

@babizhu
Copy link

babizhu commented Apr 24, 2024

"I encountered the same issue. I directly unplugged the server's network cable, and when the client did not receive a heartbeat from the server for 90 seconds, it would actively call
await _socket.DisconnectAsync(); //

However, this call takes 14 minutes to complete according to tests. Is there a way to resolve this?"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants