Skip to content

Comments

Hysteria transport: Fix speedtest issue#5587

Merged
RPRX merged 1 commit intoXTLS:mainfrom
LjhAUMEM:hy-fix-2
Jan 22, 2026
Merged

Hysteria transport: Fix speedtest issue#5587
RPRX merged 1 commit intoXTLS:mainfrom
LjhAUMEM:hy-fix-2

Conversation

@LjhAUMEM
Copy link
Contributor

close #5546

出于某种原因,客户端 close stream 后服务端那边可能还在 hold 这条 stream,如果短时间内开多 stream 而不 CancelRead 可能导致新开的 stream 可以上传但收不到服务端回写的消息,可能是 http3 的特性?

这也是为什么多线程测速才会出现下载完成后卡死上传的情况而单线程没有

感谢 @hedsbj@missyea 的反馈

@hedsbj
Copy link

hedsbj commented Jan 22, 2026

高手,这么快就找到原因了。
非常感谢!

@Fangliding
Copy link
Member

http3不是在引导完鉴权之后就不用了吗 后面是纯quic

@LjhAUMEM
Copy link
Contributor Author

http3不是在引导完鉴权之后就不用了吗 后面是纯quic

服务端是完全的 http3 handle,通过 ProxyStreamHijacker 来获取代理的 stream

@Fangliding
Copy link
Member

对啊 server看到非http3请求把它移交给 StreamHijacker 没经过h3机制

@LjhAUMEM
Copy link
Contributor Author

但我本地测试确实是新 stream 可以 WriteTCPRequest,但是收不到 ReadTCPResponse

服务端那边也能看到新的代理请求,就是在回写出了问题

@Fangliding
Copy link
Member

文档里提了双向流的 close 和 go 的 Conn.Close() 行为不一致 这个close更像是 CloseWrite()
image

@LjhAUMEM
Copy link
Contributor Author

多线程顶多多开十几条流,也远不到 hy 服务端默认的 MaxIncomingStreams,按文档来说关闭后仍可以读,所以难道是客户端的读流满了读不了新的

https://quic-go.net/docs/quic/streams

@Fangliding
Copy link
Member

可以抓包看看到底是服务端写阻塞了没能发过来还是发过来了但是客户端读阻塞了
我之前在Windows上观察的mux.cool压力应该在30~100不等 hy2正常工作的时候应该也不会差太远 因为十几条被造死也不应该

@Fangliding
Copy link
Member

也可能是这边close后因为downlink还是存活 服务端发了一些残余数据来 但是客户端这边以为close了没人consume这些数据 卡在buffer里把客户端readbuffer占满了

@LjhAUMEM
Copy link
Contributor Author

直接套个 mask 也可以确认是服务端没发还是客户端 quic 不让 stream 读 不过也懒得去求证了,才注意到 hy 这里也注明了,总之干净的关闭是把读方向也关了

@hedsbj 你方便确认下 21244017631 还会出现卡死吗

@hedsbj
Copy link

hedsbj commented Jan 22, 2026

直接套个 mask 也可以确认是服务端没发还是客户端 quic 不让 stream 读 不过也懒得去求证了,才注意到 hy 这里也注明了,总之干净的关闭是把读方向也关了

@hedsbj 你方便确认下 21244017631 还会出现卡死吗

刚测试了一下,正常了。连续测试了2遍。我用v2rayN 在win11平台上,服务端是s-ui 中的hy2
非常感谢!

用的是这样的配置
{
"protocol": "hysteria",
"settings": {
"version": 2,
"address": "xx",
"port": xx
},
"streamSettings": {
"network": "hysteria",
"hysteriaSettings": {
"version": 2,
"auth": "xx",
"congestion": "bbr"
},
"security": "tls",
"tlsSettings": {
"serverName": "xx",
"allowInsecure": false,
"alpn": ["h3"]
}
}
}
]

@RPRX RPRX changed the title fix #5546 Hysteria transport: Fix speedtest problem Jan 22, 2026
@RPRX RPRX changed the title Hysteria transport: Fix speedtest problem Hysteria transport: Fix speedtest issue Jan 22, 2026
@RPRX RPRX merged commit 2d2102f into XTLS:main Jan 22, 2026
39 checks passed
nebulabox added a commit to nebulabox/Xray-core that referenced this pull request Jan 28, 2026
* commit 'f6a7e939231e5ec6b167628bf730dc70a3c36707': (90 commits)
  VMess inbound: Optimize replay filter (XTLS#5562)
  Bump github.com/pires/go-proxyproto from 0.9.1 to 0.9.2 (XTLS#5614)
  TUN inbound: Add iOS support (XTLS#5612)
  Geodat: Reduce peak memory usage (XTLS#5581)
  Bump github.com/pires/go-proxyproto from 0.9.0 to 0.9.1 (XTLS#5608)
  Hysteria transport: Support range & random for `interval` in `udphop` as well (XTLS#5603)
  TUN inbound: Enhance Darwin interface support (XTLS#5598)
  XUDP client: Initialize Global ID's BaseKey correctly (XTLS#5602)
  TUN inbound: Disable RACK/TLP recovery to fix connection stalls (XTLS#5600)
  v26.1.23
  common/errors/feature_errors.go: Add PrintNonRemovalDeprecatedFeatureWarning() (XTLS#5567)
  API: Add ListRule() for routing (XTLS#5569)
  Log config: More flexible `maskAddress` (XTLS#5570)
  Bump github.com/miekg/dns from 1.1.70 to 1.1.72 (XTLS#5590)
  Bump github.com/cloudflare/circl from 1.6.2 to 1.6.3 (XTLS#5589)
  Hysteria transport: Fix speedtest issue (XTLS#5587)
  README.md: Add fancyss to Asuswrt-Merlin Clients
  Router: Fix panic in ProcessNameMatcher when source IPs are empty (XTLS#5574)
  README.md: Update links for PassWall & PassWall 2 (XTLS#5572)
  Tests: Reduce RAM usage (XTLS#5577)
  ...

# Conflicts:
#	core/core.go
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

Successfully merging this pull request may close these issues.

最新版本跑hy2,只要speedtest.net测速就会断网

4 participants