SuperSocket icon indicating copy to clipboard operation
SuperSocket copied to clipboard

有客户端不断请求和断开,会导致服务后面无法正常连接。

Open XuLinFei opened this issue 2 years ago • 7 comments

客户端采用4G连接,但是由于网络不好导致部分客户端会不断的断线连接。随后慢慢会导致整个服务都不能被连接。然后重启会显示 open too many files 的错误。

XuLinFei avatar May 31 '23 06:05 XuLinFei

Which version do you use?

kerryjiang avatar Jun 01 '23 05:06 kerryjiang

+1 版本最新 .17 此前版本也出现这种情况

GhostDevil avatar Jun 13 '23 06:06 GhostDevil

Do you have a unit test to cover this case?

kerryjiang avatar Jun 21 '23 20:06 kerryjiang

我在另一个现场,大概是40个客户端。用的以太网链接。也出现了这个问题。 下位机的通信逻辑是连接上发送注册指令,然后上位机(supersocket实现的)回复注册指令。如果五秒内没有得到回复,下位机就会重新建立请求并发送注册指令。然后我现在发送回复注册时发现下位机的socket已经掉线了,并且整个服务无法被正常连接。我不知道我该怎么去避免这个问题?我是用的版本是 2.0.0-beta.17

XuLinFei avatar Jul 07 '23 07:07 XuLinFei

我开始也以为是supersocket的bug,后来发现问题还是出现在设备上,我们的设备心跳机制有问题,会导致频繁断开链接。 你可以在下位机连上之后,尝试给你的设备发送一份不会影响业务的短数据,来保持链接的活跃。 另外当你的下位机连接上之后,发送过来注册指令,你应该能毫秒级回复的。 建议把会话对象(客户端端口)存储在队列中,每一个下位机拥有自己独立的上位机数据处理对象,多线程去接收处理下位机数据。

从 Windows 版邮件发送

发件人: XuLinFei 发送时间: 2023年7月7日 15:35 收件人: kerryjiang/SuperSocket 抄送: GhostDevil; Comment 主题: Re: [kerryjiang/SuperSocket] 有客户端不断请求和断开,会导致服务后面无法正常连接。 (Issue #658)

我在另一个现场,大概是40个客户端。用的以太网链接。也出现了这个问题。 下位机的通信逻辑是连接上发送注册指令,然后上位机(supersocket实现的)回复注册指令。如果五秒内没有得到回复,下位机就会重新建立请求并发送注册指令。然后我现在发送回复注册时发现下位机的socket已经掉线了,并且整个服务无法被正常连接。我不知道我该怎么去避免这个问题?我是用的版本是 2.0.0-beta.17 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

GhostDevil avatar Jul 07 '23 08:07 GhostDevil

We did a test client, and a lot of tests on the wired network were fine. At first thought that the next machine is the 4G network problem, due to the relationship between the 4G network, the test is relatively difficult, after a long time of investigation, found that after the heartbeat mechanism of the next machine is opened, the next machine will be disconnected, so this problem may not completely exist in the library, or the library is normal. 从 Windows 版邮件发送

发件人: Kerry Jiang 发送时间: 2023年6月22日 4:30 收件人: kerryjiang/SuperSocket 抄送: GhostDevil; Comment 主题: Re: [kerryjiang/SuperSocket] 有客户端不断请求和断开,会导致服务后面无法正常连接。 (Issue #658)

Do you have a unit test to cover this case? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

GhostDevil avatar Jul 07 '23 08:07 GhostDevil

能用测试用例重现这个问题就最好了。

kerryjiang avatar Jul 16 '23 07:07 kerryjiang