Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Our Hysteria2 connections died after every upload speed test. The fix was 37 lines.

Description and use

After an upload speed test, Hysteria2 QUIC connections stopped sending stream data despite remaining alive. Adding a 10‑second write timeout and closing the target on client abort fixed the issue.

Problem

Hysteria2 QUIC connections stopped sending stream data after an upload speed test, causing the transport to be declared dead while the connection appeared healthy.

Outcome

Adding a per‑write stall timeout and immediate target closure resolved the issue, allowing Hysteria2 to recover from stalled uploads without manual intervention.

Workflow

  • 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.

Evidence

The client uploads through a Hysteria2 stream. The server dials the target over TCP and copies the stream into it.

Source

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.

Source

  • Record date: 2026-10-16T00:41:21.655Z