#1908·Throne

[Bug] Hysteria2 tunnel disconnects after ~120s idle: `keep_alive_period` / `idle_timeout` profile settings are ignored by the embedded core

Author: AuthenticSm1lesCreated Sep 21, 2026Updated Sep 22, 2026
LabelsNeed more InfoNot Reproducible

Operating system

Linux

System version

Arch Linux

Installation type

package manager

Version

1.3.0 (release 2026-09-17)

Description

Summary

Every Hysteria2 tunnel connection is killed by the server at exactly ~120 s of inactivity with:

client disconnected  addr: <client>:<port>  id: user  error: accepting stream failed: timeout: no recent network activity

The profile options meant to prevent this — keep_alive_period, idle_timeout, disable_chrome_parrot — are stored in the profile JSON but never read by the embedded core. This is not a server issue: hysteria's server has no server-side keepalive and hard-caps maxIdleTimeout at 4–120 s. Keeping a connection alive is the client's job (hysteria client config quic.keepAlivePeriod, default 10 s; the official client even treats it as mandatory). Throne's core never emits the QUIC keepalive PINGs, so every idle connection dies at the 120 s cap.

Expected

Client-side QUIC keepalive PINGs are sent while idle (per keep_alive_period, and at latest the default ~10 s), resetting the server's idle timer so an idle connection never hits the 120 s cap.

Actual

The connection sends nothing during idle; the server (correctly) tears it down at 120 s. Any long-lived session on top (e.g. an HTTPS/API stream with a >120 s idle gap) is killed mid-flight and the app surfaces TLS/certificate errors; reconnects pile up while old connections linger to their own expiry.

Root cause (verified against source)

1. Profile settings are inert

Profile JSON correctly contains idle_timeout, keep_alive_period, disable_chrome_parrot — the core ignores them.

2. Throne's fork of sing-box dropped the QUIC-options plumbing (diff vs upstream)

File (same paths on both) Upstream SagerNet/sing-box @stable Throne fork throneproj/sing-box @stable
protocol/hysteria2/outbound.go lines 142–144: builds qtls.QUICOptions{ IdleTimeout: options.IdleTimeout.Build(), KeepAlivePeriod: options.KeepAlivePeriod.Build(), … } → hysteria2.New no QUIC-option code at all
option/hysteria2.go embeds option.QUICOptions (lines 23/214) + DisableChromeParrot (217) fields absent
go.mod pins sing-quic v0.7.0 · quic-go v0.61.0-sing-box-mod.7 sing-quic …d83826c306d7 · quic-go v0.59.0-sing-box-mod.5

The pinned sing-quic (d83826c306d7) exposes no QUICOptions/ApplyQUICOptions, and its hysteria2/client.go hardcodes MaxIdleTimeout: 30s + KeepAlivePeriod: 10s without applying caller options — so even a wired outbound could not express them against this dependency.

3. Even the hardcoded 10 s keepalive default doesn't fire at runtime

With pinned quic-go v0.59.0-sing-box-mod.5 (= d87ea939, 2026-05-02) the client still sends zero packets while idle. The keepalive scheduler exists in that revision, but in the hysteria2 client path no PING is ever transmitted — plausibly the injected-BBR "application limited" path keeping the connection perma-blocked at idle (this area was subsequently fixed upstream in sagernet/quic-go@0cae1a7 "Fix application limited reporting to injected congestion controllers", 2026-08-30).

Reproduction

Reproduction (controlled A/B, same server & auth)

Official hysteria client v2.9.2, idle, against the same VPS with the same auth/tls.sni:

Client Idle duration Server outcome
Official client (keepalive on, 10 s) 240 s still connected; closed only by my test timeout — zero no recent network activity
Official client (2nd run) 130 s identical
ThroneCore (this bug) every connection killed at 121–126 s

Impact

Any tunnel user with idle periods >~2 min (mobile, long-lived streaming/API sessions over the tunnel, idling laptop) is disconnected every ~120 s with reconnect storms and app-visible TLS errors.

Suggested fix

  1. Restore the hysteria2 QUIC-option wiring in protocol/hysteria2/outbound.go and option/hysteria2.go (sync with upstream).
  2. Bump sagernet/sing-quic to a release with ApplyQUICOptions (e.g. v0.7.0) and sagernet/quic-go to the matching sing-box-mod release.
  3. Verify keepalive PINGs actually transmit in the hysteria2 client (older quic-go revision didn't send even the hardcoded default; 0cae1a7 looks relevant).
  4. Re-expose keep_alive_period / idle_timeout / disable_chrome_parrot for hysteria2 profiles in the editor.

References

  • Upstream wiring: SagerNet/sing-box@stable protocol/hysteria2/outbound.go:142-144, option/hysteria2.go:214,217
  • Throne fork: throneproj/sing-box@stable (same files), go.mod
  • Pinned sing-quic: sagernet/sing-quic@d83826c306d7 quic.go, hysteria2/client.go
  • Pinned quic-go: sagernet/[email protected] (= d87ea939) connection.go
  • Hysteria semantics: server quic.maxIdleTimeout cap 4–120 s / no server keepalive; client quic.keepAlivePeriod default 10 s (cannot be disabled)

Logs

bash