如何用“未知原因"调试websocket连接错误 [英] How to debug websocket connection error with "Unknown reason"

查看:20
本文介绍了如何用“未知原因"调试websocket连接错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近,我在 chrome 控制台上收到以下消息;

WebSocket 连接到ws://evo15:4008/?stream"失败:未知原因

它变得越来越多,而且有点烦人,我每次都必须打开一个新选项卡或重新启动 chrome 才能恢复正常的 websocket 连接.我该如何调试它?不幸的是,我还不能重现它.我的 chrome 版本是 Version 77.0.3865.75 (Official Build) (64-bit)

更新 1:我认为您可以通过从服务器端关闭连接很长时间(我不知道确切时间)然后打开它并尝试连接来重现它(客户端每 1 秒尝试连接一次).那么它就会发生.所以我猜有一个过期时间或有限的尝试连接某处的次数.

更新 2:在尝试重新连接 256 次后发生.

WebSocket 连接到ws://evo15:4008/?stream"失败:连接建立错误:net::ERR_CONNECTION_REFUSED

在控制台看到这个错误的 255 后,您将看到第一个错误并且无法重新连接.所以我认为我遗漏的地方有 8 位限制

解决方案

看起来有人刚刚将此作为 Chromium (v77) 错误提交.请参阅

Recently, I am getting the following message on chrome console;

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. How can I debug it? Unfortunately, I cannot reproduce it yet. My chrome version is 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). 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.

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. So I think there is a 8 bit limit somewhere that I am missing

解决方案

Looks like someone just filed this as a Chromium (v77) bug. 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).

Update 2: Despite the bug being marked as fixed/closed in monorail, canary (80.0.3977.4) still appears to have this behavior. As others have noted there is a global limit of 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.

这篇关于如何用“未知原因"调试websocket连接错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆