mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #5740] [Bug]: Intermittent node traffic freeze with no Xray logs or errors #3990
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#3990
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 @mrpipo79 on GitHub (Jul 2, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5740
Describe the bug
When using a master server with three connected nodes, a random issue occasionally occurs after adding traffic quota to a user or resetting a user's traffic usage.
Randomly, one of the nodes stops forwarding any traffic. The affected node does not produce any Xray errors, application logs, or other warning messages. It simply stops passing traffic for all users on that node.
The only way to restore functionality is to restart the Xray service on the affected node.
How to reproduce the problem
Start with a clean installation of the master server and connect three nodes.
Ensure all nodes are online and forwarding traffic normally.
Create users and verify traffic is working on all nodes.
Repeatedly add traffic quota to users or reset their traffic usage from the panel.
Continue normal usage for some time.
Result:
Occasionally, one of the connected nodes randomly stops forwarding traffic. No Xray errors or application logs are generated. The issue cannot be reproduced consistently.
Workaround:
Restarting the Xray service on the affected node immediately restores normal traffic forwarding.
Expected behavior
After adding or resetting a user's traffic quota, all connected nodes should continue forwarding traffic normally. Updating user quotas should not interrupt traffic handling or require restarting the Xray service on any node.
Actual behavior
Occasionally, after adding or resetting a user's traffic quota, one of the connected nodes randomly stops forwarding traffic for all users. No Xray errors, application logs, or warning messages are generated. The affected node only resumes normal operation after restarting the Xray service.
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
Ubuntu22
Which parts of the panel are affected?
Backend (API endpoints, login, settings)
Browser (only if it is a UI bug)
Chrome
Is the panel behind a reverse proxy or CDN?
Yes — Cloudflare (proxied DNS)
Before submitting
@github-actions[bot] commented on GitHub (Jul 2, 2026):
The most likely mechanism is confirmed in the source: a full, forced restart of one specific node's entire Xray process is triggered automatically whenever any client hosted on that node exhausts its quota or expires — this is not necessarily caused by your own "add quota" / "reset traffic" action itself, but by some other client crossing its limit during the same window of activity.
Confirmed chain:
cadenceXrayTraffic/cadenceNodeTraffic = "@every 5s",internal/web/web.go:289,293),XrayTrafficJobandNodeTrafficSyncJobboth callInboundService.AddTraffic(internal/web/service/inbound_traffic.go:21-32), which runsdisableInvalidClients(internal/web/service/inbound_disable.go:83-157). This scansclient_trafficsfor any client — local or node-hosted — whoseup+down >= totalor whoseexpiry_timehas passed, and disables it.node_idset, that node's ID is collected and passed torestartRemoteNodesOnDisable(internal/web/service/inbound_node.go:898-918).restartXrayOnClientDisable, defaulttrue—internal/web/service/setting.go:111,872-878), this callsRemote.RestartXray(internal/web/runtime/remote.go:534-537), which sendsPOST panel/api/server/restartXrayServiceto that specific node.internal/web/controller/server.go:68,271-277) callsServerService.RestartXrayService()(internal/web/service/server.go:844-851), which callsXrayService.RestartXray(true)— a forced full stop-then-start of the entire Xray process (internal/web/service/xray.go:939-971), not a per-client hot patch. This drops every inbound and every connected client on that node for the duration of the restart.This lines up with what you're describing: only one of the three nodes is hit at a time (whichever happens to host the client that just crossed its limit), it correlates with periods of active quota management (more clients approaching their caps under normal use), and it isn't reliably reproducible on demand.
A closely related bug was fixed on 2026-07-02 in commit
e5b56c9("reconcile client auto-disable through the API instead of a forced restart", closing #5712): a forced restart on auto-disable was dropping every live connection on a single, non-multi-node panel. That fix changed only the local path ininternal/web/job/xray_traffic_job.goto a graceful per-user API reconcile. As of currentmainit has not been extended to the remote-node path above —restartRemoteNodesOnDisablestill unconditionally forces a full restart on the node. That fix also isn't in any tagged release yet, including 3.4.2, which is what you're running.What I can't confirm from the source alone is why the node fails to resume forwarding on its own afterward instead of just restarting cleanly.
Process.Start()(internal/xray/process.go:494-538) only confirms the OS process launched, not that Xray finished (re)binding every listener, so a bind-timing race with the just-stopped process's sockets can't be ruled out — but I have no log evidence either way.To confirm this is the trigger:
disableInvalidClients: restart xray on node <id> failed(only logged if the remote restart call itself errored).x-uiservice uptime — versus no restart attempt at all.This reply was generated automatically; a maintainer may follow up.
@MHSanaei commented on GitHub (Jul 2, 2026):
Fixed in
4d6f2ddd. Root cause confirmed: whenever any client hosted on a node was auto-disabled (quota exhausted or expired — not necessarily the client you were editing), the master pushed the updated inbound to the node and then also forced a full Xray restart on that node, dropping every live connection there; a restart that failed to come back cleanly left the node forwarding nothing until a manual restart. The push alone already applies the disable on the node, so the forced restart is now removed — this mirrorse5b56c94, which removed the same forced restart from the local (non-node) auto-disable path. Both fixes ship in the next release; neither is in 3.4.2. Until then, disabling Settings → Restart Xray After Auto Disable on the master avoids the node restarts.@mrpipo79 commented on GitHub (Jul 3, 2026):
Here is an update regarding the issue. I have performed the steps and checked the statuses as requested, but the freezing problem still persists intermittently.
However, I dug deeper into the database logs and found the exact root cause of the failure. Every time a user's quota is updated or traffic is reset from the master panel, the master node's PostgreSQL database throws this exact error, which seems to break the sync logic and leave the connected nodes in a frozen state:
تکهکد
ERROR: column "id" does not exist at character 70
STATEMENT: SELECT setval(pg_get_serial_sequence($1, 'id'), COALESCE((SELECT MAX(id) FROM "client_inbounds"), 1), true)
WHERE pg_get_serial_sequence($2, 'id') IS NOT NULL
Analysis:
It appears there is a database schema mismatch or an incorrect GORM/SQL query generation specifically for PostgreSQL setups. The panel is trying to reset the serial sequence of the "client_inbounds" table by selecting MAX(id), but the id column either does not exist or has a different structure in this specific table version.
When this database exception occurs, the synchronization process with the node gets interrupted or enters a deadlock, causing the node to stop forwarding traffic without writing any error logs to its own Xray core.