Our Hysteria2 connections died after every upload speed test. The fix was 37 lines.
说明与用途
上传速度测试后,Hysteria2 QUIC 连接停止发送流数据,但仍保持活跃。通过为写入添加 10 秒超时并在客户端放弃时立即关闭目标,解决了此问题。
问题
Hysteria2 QUIC connections stopped sending stream data after an upload speed test, causing the transport to be declared dead while the connection appeared healthy.
结果
Adding a per‑write stall timeout and immediate target closure resolved the issue, allowing Hysteria2 to recover from stalled uploads without manual intervention.
工作流
- 1. Capture traffic during a speed test to observe stalled state.
- 2. Reproduce the issue on a loopback server with a Python harness that aborts uploads and checks new requests.
- 3. Identify that the stall occurs when the target stops reading but keeps the connection open, filling the connection-level flow‑control window.
- 4. Add a stall guard that times out writes that make no progress for 10 s.
- 5. Close the target immediately when the client gives up the stream.
- 6. Verify that new uploads succeed after the patch.
证据
The client uploads through a Hysteria2 stream. The server dials the target over TCP and copies the stream into it.
Every write into a TCP target gets a fresh 10‑second budget. If one write makes no progress for 10 s, the target is closed.
- 记录日期: 2026-10-16T00:41:21.655Z