You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Hysteria connection may stay stuck after mobile sleep/wake until QUIC idle timeout #6408
I am using Xray-core with a Hysteria inbound/outbound on mobile clients.
When the phone goes to sleep or the screen is locked for some time, after unlocking the phone the VPN tunnel still looks connected, but internet traffic does not start working immediately. It can stay stuck for several seconds, and sometimes it looks like it only recovers after the QUIC maxIdleTimeout expires.
If I toggle the VPN connection off/on, traffic starts working immediately again.
This is probably not limited to Hysteria. XHTTP/H3 may have the same stale cached QUIC connection problem after mobile sleep/wake, although it is less visible because HTTP/3 transport can retry after request errors and XHTTP has default keepalive enabled.
Expected behavior
After the phone wakes up or the network path changes, traffic should recover quickly.
Ideally, Xray should either:
migrate the existing QUIC connection to the new path, or
detect that the cached QUIC session is no longer usable and reconnect immediately.
It should not require waiting for the QUIC idle timeout.
Actual behavior
The Hysteria connection appears to keep using the old QUIC session after mobile sleep/wake. The session is not always marked as closed immediately, so new traffic can be sent into a stale connection and gets stuck until timeout/reconnect.
Environment
Xray-core version: v26.6.1
Transport: Hysteria / QUIC / TLS
Client platform: iOS / Android mobile VPN client
Server OS: Linux
Network: happens more often after screen lock, sleep
Activity
LjhAUMEM commentedon Jun 30, 2026
复现也不需要这么复杂,在连接建立后立即重启服务端应该就是你说的那个情况
客户端目前无法感知这种情况,也许可以稍微操作一下,但现在行为是和官端一致的,还不想做额外的修改
Fangliding commentedon Jun 30, 2026
在我的设备上没什么问题 长时间熄屏后hy仍然可用 除开重启服务端这种方法 quic应该比正常tcp对这种问题抗性更强 因为如果太久没消息而导致nat终止quic甚至可以恢复 如果服务端认为这个连接死了不支持恢复那客户端的计时器应该也同步过时了才对
此类问题的终极解决办法我记得有的客户端会用API监听设备情况在换网/休眠后重启核心
LjhAUMEM commentedon Jun 30, 2026
他配了keepAlivePeriod,所以不好说。
关于我说的那个情况我本地测试过,就是等超时,第二次dial会恢复正常,官端也是一样
Hysteria: Upgrade to official v2.12.2 (XTLS#6565)