简体   繁体   English

如何使用“未知原因”调试 websocket 连接错误

[英]How to debug websocket connection error with "Unknown reason"

Recently, I am getting the following message on chrome console;最近,我在 chrome 控制台上收到以下消息;

WebSocket connection to 'ws://evo15:4008/?stream' failed: Unknown reason

It's getting more and more and it's somehow annoying and I have to open a new tab or restart chrome every time to get back to normal websocket connection.它变得越来越多,而且有点烦人,我每次都必须打开一个新选项卡或重新启动 chrome 才能恢复正常的 websocket 连接。 How can I debug it?我该如何调试它? Unfortunately, I cannot reproduce it yet.不幸的是,我还不能重现它。 My chrome version is Version 77.0.3865.75 (Official Build) (64-bit)我的 chrome 版本是Version 77.0.3865.75 (Official Build) (64-bit)

Update 1 : I think you could reproduce it by closing the connection for a long time (I don't know the exact time) from server side and then open it and try to connect to it (client trys to connect every 1 sec).更新 1 :我认为您可以通过从服务器端关闭连接很长时间(我不知道确切时间)来重现它,然后打开它并尝试连接到它(客户端尝试每 1 秒连接一次)。 Then it will happen.那么它就会发生。 So I guess there is an expire time or a limited number of tries to connect somewhere.所以我想有一个过期时间或有限次数的尝试连接到某个地方。

Update 2 : It happens after 256 tries of reconnection.更新 2 :它发生在 256 次重新连接尝试之后。

WebSocket connection to 'ws://evo15:4008/?stream' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED

After seeing 255 of this error on console, you will see the first error and cannot reconnect.在控制台上看到此错误的 255 后,您将看到第一个错误并且无法重新连接。 So I think there is a 8 bit limit somewhere that I am missing所以我认为我遗漏了一个 8 位的限制

在此处输入图片说明

Looks like someone just filed this as a Chromium (v77) bug.看起来有人刚刚将此作为 Chromium (v77) 错误提交。 See issue tracking it here . 在此处查看 问题跟踪

Update 1: As noted in the issue tracker and comments below, this should now be fixed in the latest stable release, which is being rolled out now (2019/10/11).更新 1:正如下面的问题跟踪器和评论中所指出的,现在应该在最新的稳定版本中修复这个问题,该版本现在正在推出 (2019/10/11)。

Update 2: Despite the bug being marked as fixed/closed in monorail, canary (80.0.3977.4) still appears to have this behavior.更新 2:尽管错误在单轨铁路中被标记为已修复/已关闭,但金丝雀 (80.0.3977.4) 似乎仍具有此行为。 As others have noted there is a global limit of 255 .正如其他人所指出的,全局限制为255 However, the fact that connections opened by JS don't get closed/reset when the page is refreshed still seems like a bug to me.但是,JS 打开的连接在页面刷新时不会关闭/重置这一事实对我来说仍然是一个错误。 Chrome canary(版本 80)的屏幕截图展示了 WebSocket 限制/错误

For some very very very odd reason in my computer the websocket connection was considered as an ad by AdBlock.出于某些非常非常奇怪的原因,在我的计算机中,Websocket 连接被 AdBlock 视为广告。

Try to disable AdBlock and see if it works.尝试禁用 AdBlock 并查看它是否有效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM