Skip to content

Hysteria outbound: Fix UDP DATAGRAM truncation with ChromeParrot - #6788

Merged
RPRX merged 4 commits into
XTLS:mainfrom
Katze-942:fix-chromeparrot-hysteria2
Sep 20, 2026
Merged

RPRX merged 4 commits into
XTLS:mainfrom
Katze-942:fix-chromeparrot-hysteria2

Conversation

@Katze-942

Copy link
Copy Markdown
Contributor

I had a proxy chain with Hysteria2 tunneled through another Hysteria2 connection. After updating to Xray-core v26.9.9, my requests started timing out.

As I understand it, ChromeParrot was introduced in Xray-core v26.9.8 and sets max_datagram_frame_size = 65536. As a result, Hysteria can receive DATAGRAMs larger than the 1200-byte limit hard-coded in Xray.

Only the first 1200 bytes were returned as a successfully read packet, while the rest was lost. This caused the nested Hysteria2 chain to time out.

I increased the receive buffer in UDPReader to the standard Xray buffer size. However, this will probably increase memory usage, and I am not sure what the best approach would be. I also changed InterConn.Read to return io.ErrShortBuffer when the destination buffer is too small instead of silently truncating the packet.

@LjhAUMEM

Copy link
Copy Markdown
Contributor

服务端不可能接受 65536,改成 1500 就行,另外 io.ErrShortBuffer 那里去掉

@LjhAUMEM

Copy link
Copy Markdown
Contributor

奇怪,刚写了个测试最大还是 1197,你这个客户端应用 ChromeParrot 后大小会改变的根据是哪里来的

@LjhAUMEM

Copy link
Copy Markdown
Contributor

@Katze-942 你看下 #6792 的测试没问题这个就 close 吧

不回复明天我再 close

@Katze-942

Copy link
Copy Markdown
Contributor Author

服务端不可能接受 65536,改成 1500 就行,另外 io.ErrShortBuffer 那里去掉

Done

奇怪,刚写了个测试最大还是 1197,你这个客户端应用 ChromeParrot 后大小会改变的根据是哪里来的
@Katze-942 你看下 #6792 的测试没问题这个就 close 吧

1197 is the client-to-server limit, which is exactly what the test demonstrates. ChromeParrot also affects the reverse direction-from the server to the client-and in that direction I get 1243.

@LjhAUMEM

Copy link
Copy Markdown
Contributor

server 发 client 我得出的也是 1197,除非这玩意是动态变化的,或者你的服务端不是官方实现,不过改到 1500 就改吧,我把测试移到你这里

@LjhAUMEM

Copy link
Copy Markdown
Contributor

哦,前面的测试写错了,客户端加入 ChromeParrot 后服务端真的改为 1243,如果没有 CP 才是原来的 1197

@RPRX RPRX changed the title Hysteria: fix UDP DATAGRAM truncation with ChromeParrot Hysteria outbound: Fix UDP DATAGRAM truncation with ChromeParrot Sep 20, 2026
@RPRX
RPRX merged commit d562d89 into XTLS:main Sep 20, 2026
40 checks passed
GFW-knocker pushed a commit to GFW-knocker/Xray-core that referenced this pull request Oct 2, 2026
…S#6788)

XTLS#6788 (comment)

---------

Co-authored-by: LjhAUMEM <[email protected]>
(cherry picked from commit d562d89)

[GFW-knocker: import paths in the new test rewritten to github.com/GFW-knocker/Xray-core.]
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.

3 participants