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

[Bug]终于找到 hysteria2 在 1.18.1 以后加入端口跳跃后 出现 断流问题 的根源了 #1240

Closed
7 tasks done
moranno opened this issue May 1, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@moranno
Copy link

moranno commented May 1, 2024

Verify steps

  • I have read the documentation and understand the meaning of all configuration items I have written, avoiding a large number of seemingly useful options or default values.
  • I have not reviewed the documentation and resolve this issue.
  • I have not searched the Issue Tracker for the problem I am going to raise.
  • I have tested with the latest Alpha branch version, and the issue still persists.
  • I have provided server and client configuration files and processes that can reproduce the issue locally, rather than a desensitized complex client configuration file.
  • I have provided the simplest configuration that can reproduce the error I reported, rather than relying on remote servers, TUN, graphical client interfaces, or other closed-source software.
  • I have provided complete configuration files and logs, rather than providing only parts that I believe are useful due to confidence in my own intelligence.

Operating System

MacOS, Windows

System Version

mac 14, win 11

Mihomo Version

1.18.2-1.18.4-alpha

Configuration File

- name: 🇦🇪美国1
  type: hysteria2
  server: us1.jichangnode.xyz
  port: 25000
  ports: 20000-30000
  password: 3f663871-d2d4-4f78-8a3b-4ee4b55fce73
  skip-cert-verify: true

Description

当一个节点使用DNS负载均衡有多个IP地址时,会出现断流。

我的节点us1.jichangnode.xyz下有2个IP地址解析:
1.1.1.1
2.2.2.2
且2个服务器hy2server的配置完全相同(开放相同的端口,相同的用户,甚至相同的系统版本和硬件配置)。

我测试了:
单独连接IP 1.1.1.1和2.2.2.2--->正常,不会断流
域名下只有单个IP解析--->正常,不会断流
域名有2个以上解析--->3-5分钟内断流,10-30秒自动恢复

猜想:
因为端口跳跃的引入,莫名触发了bug连接域名下的另外一个IP,但quic连接迁移的特性,连接到另外一个IP的时候并没有带认证头等信息,导致断流;而等10-30秒后再次端口跳跃,触发返回之前的IP,恢复连接。

Reproduction Steps

1.服务器地址使用域名
2.域名下解析有多个IP地址(DNS负载均衡)
3.使用1.18.2以后内核连接该域名,观察一般在3-5分钟内必出现断流,10-30秒后能自动恢复。

Logs

打开debug后,日志中没有出现有价值的报错。
@moranno moranno added the bug Something isn't working label May 1, 2024
@wwqgtxx
Copy link
Collaborator

wwqgtxx commented May 1, 2024

端口跳跃本质上是用于同一个服务器的,并没有考虑到服务器域名会解析出多IP的情况

@Skyxim
Copy link
Collaborator

Skyxim commented May 1, 2024

如果你多个 IP 不是同一台服务器请分离使用

@moranno
Copy link
Author

moranno commented May 1, 2024

端口跳跃本质上是用于同一个服务器的,并没有考虑到服务器域名会解析出多IP的情况

这方面能否完善一下呢?
测试案例1:
我这边还测试了hy2原版client,有端口跳跃,连接相同us1.jichangnode.xyz域名,未出现断流的情况。

测试案例2:
meta内核hy1,相同域名,开启端口跳跃,也是多个解析IP,也没有断流情况。

所以能否请您再review一遍端口跳跃的相关代码,确定下是不是这个跳跃触发了跳IP的操作。
在1.18.1之前,我一直也是1个域名下多个IP的负载方案。

如果你多个 IP 不是同一台服务器请分离使用

使用dns负载均衡主要有如下使用场景:
1.单台服务器流量有限,使用dns负载均衡,可以粗粒度的把流量分摊到多台服务器(特别是以月为时间单位来看,使用了dns负载均衡后,多台服务器流量使用近似)
2.相同地区,相同服务商的线路相同,用户连接一个节点,自动负载均衡,防止用户扎堆在某一台服务器上,缓解服务器CPU压力。

@wwqgtxx
Copy link
Collaborator

wwqgtxx commented May 1, 2024

试一下 8861eaf

@moranno
Copy link
Author

moranno commented May 1, 2024

试一下 8861eaf

感谢,连续测试了30分钟,没有再出现断流了。

@wwqgtxx wwqgtxx closed this as completed May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants