mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #5712] [Bug] Panel stops completely and XHTTP connection closes after updating to v3.4.2 & showing the crash and cookie error #3975
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#3975
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 @tradeahadi-cmyk on GitHub (Jul 1, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5712
Describe the bug
Description:
Hello,
After updating the panel to version 3.4.2, I am experiencing critical issues where the core completely stops working. There seem to be two connected problems: a session/cookie error in the panel and a network connection drop related to XHTTP on port 443.
Steps to Reproduce:
Expected Behavior:
The panel should maintain active sessions without stopping the core, and the XHTTP inbound on port 443 should remain stable and continue serving traffic without closing the network connection.
Error Logs:
Panel/System Logs (showing the crash and cookie error):
Plaintext
Jul 01 10:16:51 tun /usr/local/x-ui/x-ui[1663]: INFO - Remove Inbound User [Username] due to expiration or traffic limit
Jul 01 10:24:25 tun x-ui[1663]: 2026/07/01 10:24:25 ERROR [sessions] ERROR! err="securecookie: the value is not valid"
Jul 01 10:24:25 tun x-ui[1663]: 2026/07/01 10:24:25 ERROR [sessions] ERROR! err="securecookie: the value is not valid"
Xray Logs (showing the XHTTP drop):
Plaintext
2026/07/01 09:50:03 ERROR - XRAY: transport/internet/splithttp: failed to serve HTTP for XHTTP > accept tcp [::]:443: use of closed network connection
Environment:
Any guidance or a hotfix for this issue would be greatly appreciated.
How to reproduce the problem
Expected behavior
No response
Actual behavior
No response
Relevant logs
Screenshots
No response
3x-ui version
3.4.2
Xray-core version
No response
How did you install 3x-ui?
install.sh script
Operating system
ubuntu24
Which parts of the panel are affected?
No response
Browser (only if it is a UI bug)
chrome
Is the panel behind a reverse proxy or CDN?
None
Before submitting
@github-actions[bot] commented on GitHub (Jul 1, 2026):
The XHTTP disconnect and the panel session/cookie error are two independent code paths. Xray-core runs as a separate managed child process from the panels web server (
internal/xray/process.go), so a session-cookie problem in the panel cannot itself crash or restart Xray.XHTTP "use of closed network connection" on port 443
This is very likely explained by the
Restart Xray After Auto Disablesetting (Settings General; keyrestartXrayOnClientDisable, enabled by default confirmed ininternal/web/service/setting.go). When a client expires or hits its traffic limit,XrayTrafficJob.Run()(internal/web/job/xray_traffic_job.go:39-58), which polls every 5 seconds (cadenceXrayTraffic = "@every 5s"ininternal/web/web.go), callsxrayService.RestartXray(true).In
RestartXray(internal/web/service/xray.go:939-971),isForce=truealways takes the "stop the running process, then start a brand-new one" path. The API-based hot reload (tryHotApply, which can apply added/removed clients through Xrays gRPC API without touching any listener) is only attempted when the restart is not forced. A full process stop closes every listener, including the XHTTP inbound on port 443 which is exactly what producesfailed to serve HTTP for XHTTP ... use of closed network connection: any in-flightAccept()on that socket errors the moment it is closed. This auto-restart mechanism was added 2026-05-04, so it predates 3.4.2, but if clients are regularly expiring or hitting traffic limits on your panel, it will force a full Xray restart (and drop the XHTTP listener) on every such event.To confirm and mitigate:
Restart Xray After Auto Disablein Settings General and see if the XHTTP drops stop.x-uimenu Xray status, orsystemctl status x-ui). The log line itself is an expected, transient side effect of any restart; if the core does NOT come back afterward, that points to a separate startup failure and we would need the Xray stdout/stderr right after that line.securecookie: the value is not validThis error means the cookie-session library failed to verify a cookies signature; it only affects panel logins, not Xray/XHTTP. The signing key is read once at startup from the
secretrow in the settings table (SettingService.GetSecret,internal/web/service/setting.go:634-643), generated once and persisted to the database a normal panel restart reuses the same key and should not invalidate existing session cookies. We found no change to the session/cookie code in the 3.4.x releases (the last logic change tointernal/web/session/session.gopredates 3.4.0), so we cannot confirm this is a new regression in 3.4.2 versus a pre-existing or environmental condition.To narrow it down, please provide:
3x-uicookie, and logging back in resolves it, or it recurs continuously on an already-open session.securecookieerrors with real timestamps, so we can see whether the two are actually correlated or coincidental.This reply was generated automatically and a maintainer may follow up.
@tradeahadi-cmyk commented on GitHub (Jul 1, 2026):
Thank you for the incredibly detailed analysis. You are completely right, and this perfectly explains the behavior I am seeing.
Regarding the XHTTP / "use of closed network connection" issue:
Restart Xray After Auto Disablesetting to confirm the connection drops stop.tryHotApply) instead of a forced process restart in future releases?Regarding the
securecookieerror:Your suspicion about multiple nodes is spot on and explains everything.
secretfor cookie signatures, or the traffic routing between the master and nodes is invalidating the sessions.I will monitor the panel after adjusting the settings and test clearing the cookies to see if the session stabilizes across the nodes.
Thanks again for pointing me in the exact right direction!
@MHSanaei commented on GitHub (Jul 2, 2026):
Fixed in
e5b56c94, directly addressing your follow-up question: client expirations and traffic-limit disables are now reconciled through the Xray gRPC API instead of a forced process restart. The disable path already removed the user from the running core; the redundant full restart that killed every live connection (your XHTTP drops on 443) is gone, and the config re-sync now happens as per-user API operations for VLESS/VMess/Trojan inbounds without touching any listener.Restart Xray After Auto Disablestill works as the on/off switch for the reconcile.The securecookie errors are, as you confirmed, your multi-node/PostgreSQL topology issuing cookies signed with different secrets — not a panel bug. Make sure all panel instances serving the same hostname share one database (one
secretrow), or pin sessions to one instance at the load balancer. Will ship in the next release.