mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #5713] [Bug]: connection drop after 5 minutes when user its not using #3977
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#3977
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @usamirali on GitHub (Jul 1, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5713
Describe the bug
my protocol is hysteria2 tls and trojan tcp tls
i change the the xray disable user after 300 seconds to 30000 seconds
and keepalive to 10 seconds
but when user not using for 5 minutes or 10
connection goes drop and user needs to restart the connection
How to reproduce the problem
1.when user connection is on and user is working its so good
2.when user dont use connection going to lost after 5 minutes
3.i change the xray difualt drop connection to 30000 and keepalive to 10 seconds but it didnt work
Expected behavior
No response
Actual behavior
No response
Relevant logs
Screenshots
No response
3x-ui version
3.4.2
Xray-core version
26.6.27
How did you install 3x-ui?
install.sh script
Operating system
ubuntu 26
Which parts of the panel are affected?
No response
Browser (only if it is a UI bug)
No response
Is the panel behind a reverse proxy or CDN?
None
Before submitting
@github-actions[bot] commented on GitHub (Jul 1, 2026):
The two protocols have different, separate causes here, both confirmed in the xray-core / 3x-ui source.
Hysteria2
The idle timeout for Hysteria2 is
streamSettings.hysteriaSettings.udpIdleTimeouton the inbound itself, not a global "300 seconds" setting. xray-core hard-enforces this between 2 and 600 seconds — a value outside that range makes xray-core refuse to start the config (we've seen the exact rejection,UdpIdleTimeout must be between 2 and 600, in a prior report, #5117). On the version you're running (v3.4.2), the panel's own input for this field is capped at 600 (frontend/src/pages/inbounds/form/protocols/hysteria.tsx), so30000cannot actually be saved there — the real ceiling is 600 seconds (10 minutes), which matches what you're observing. There is no server-side setting in 3x-ui or xray-core that lets an idle Hysteria2 session live longer than that; the only way to keep one alive past 10 minutes of true inactivity is for the client app to send its own periodic traffic (keepalive/heartbeat) within that window.Trojan (TCP)
The "disable after 300 seconds" behavior you're describing is xray's connection policy
connIdle(default 300s), set at Xray Configs → Connection Limits → Idle Timeout. Unlike the Hysteria2 field, this one has no upper bound in the panel, so raising it to 30000 should be accepted, and it takes effect immediately (saving that page automatically restarts Xray if it's running). If Trojan is still dropping at ~5 minutes after that change,connIdlelikely isn't the cause. Please check:30000was actually saved under Xray Configs → Connection Limits, and that no error toast appeared when saving (you can confirm the current value in the raw JSON via the same page — look forpolicy.levels["0"].connIdle).To narrow this down further, could you share:
policysection of Xray Configs (raw JSON view) so we can confirmconnIdlewas actually persisted at 30000.journalctl -u x-ui --since "10 minutes ago"on the server).This reply was generated automatically; a maintainer may follow up.
@MHSanaei commented on GitHub (Jul 2, 2026):
Closing — this is not a panel bug. For Hysteria2, xray-core hard-caps the idle timeout (udpIdleTimeout) at 600 seconds, so an idle session cannot be kept alive past 10 minutes server-side; the client app needs to send its own keepalive traffic. For Trojan, the drop is governed by the connIdle policy and TCP keepalive sockopts (both Idle and Interval must be set together), or by a NAT/router timeout between you and the server — see the detailed guidance above. If you can show connIdle=30000 persisted in the raw policy JSON and drops still occurring at exactly 5 minutes with the Xray log from the moment of a drop, please reopen.