[GH-ISSUE #5740] [Bug]: Intermittent node traffic freeze with no Xray logs or errors #3990

Closed
opened 2026-10-31 20:36:22 +07:00 by bsakaguchi · 3 comments
Owner

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

No relevant logs are generated when the issue occurs.

* Xray logs: No errors or warnings.
* Application logs: No related errors or warnings.
* The affected node appears healthy, but it stops forwarding traffic until the Xray service is restarted.

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

  • I searched existing issues and this bug has not been reported.
  • I am running the latest released version of 3x-ui (or have verified the bug still exists on it).
  • This bug report is written in English.
  • I have redacted any sensitive data (tokens, real domains, client UUIDs).
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 ```shell No relevant logs are generated when the issue occurs. * Xray logs: No errors or warnings. * Application logs: No related errors or warnings. * The affected node appears healthy, but it stops forwarding traffic until the Xray service is restarted. ``` ### 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 - [x] I searched [existing issues](../issues?q=is%3Aissue) and this bug has not been reported. - [x] I am running the latest released version of 3x-ui (or have verified the bug still exists on it). - [x] This bug report is written in English. - [x] I have redacted any sensitive data (tokens, real domains, client UUIDs).
bsakaguchi 2026-10-31 20:36:22 +07:00
Author
Owner

@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:

  • Every 5 seconds (cadenceXrayTraffic/cadenceNodeTraffic = "@every 5s", internal/web/web.go:289,293), XrayTrafficJob and NodeTrafficSyncJob both call InboundService.AddTraffic (internal/web/service/inbound_traffic.go:21-32), which runs disableInvalidClients (internal/web/service/inbound_disable.go:83-157). This scans client_traffics for any client — local or node-hosted — whose up+down >= total or whose expiry_time has passed, and disables it.
  • For a disabled client whose inbound has node_id set, that node's ID is collected and passed to restartRemoteNodesOnDisable (internal/web/service/inbound_node.go:898-918).
  • If Settings → General → "Restart Xray After Auto Disable" is enabled (setting key restartXrayOnClientDisable, default true — internal/web/service/setting.go:111,872-878), this calls Remote.RestartXray (internal/web/runtime/remote.go:534-537), which sends POST panel/api/server/restartXrayService to that specific node.
  • On the node, that endpoint (internal/web/controller/server.go:68,271-277) calls ServerService.RestartXrayService() (internal/web/service/server.go:844-851), which calls XrayService.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 in internal/web/job/xray_traffic_job.go to a graceful per-user API reconcile. As of current main it has not been extended to the remote-node path above — restartRemoteNodesOnDisable still 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:

  1. Check whether Restart Xray After Auto Disable is enabled on the master. If disabling it stops the freezes, that confirms this path.
  2. On the master, check logs around an incident for disableInvalidClients: restart xray on node <id> failed (only logged if the remote restart call itself errored).
  3. On the affected node, at the next occurrence, check whether Xray actually restarted around the time forwarding stopped — a new PID, a fresh "Xray ... started" line in the Xray log, or the x-ui service uptime — versus no restart attempt at all.

This reply was generated automatically; a maintainer may follow up.

<!-- gh-comment-id:4864874296 --> @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: - Every 5 seconds (`cadenceXrayTraffic`/`cadenceNodeTraffic = "@every 5s"`, `internal/web/web.go:289,293`), `XrayTrafficJob` and `NodeTrafficSyncJob` both call `InboundService.AddTraffic` (`internal/web/service/inbound_traffic.go:21-32`), which runs `disableInvalidClients` (`internal/web/service/inbound_disable.go:83-157`). This scans `client_traffics` for *any* client — local or node-hosted — whose `up+down >= total` or whose `expiry_time` has passed, and disables it. - For a disabled client whose inbound has `node_id` set, that node's ID is collected and passed to `restartRemoteNodesOnDisable` (`internal/web/service/inbound_node.go:898-918`). - If **Settings → General → "Restart Xray After Auto Disable"** is enabled (setting key `restartXrayOnClientDisable`, default `true` — `internal/web/service/setting.go:111,872-878`), this calls `Remote.RestartXray` (`internal/web/runtime/remote.go:534-537`), which sends `POST panel/api/server/restartXrayService` to that specific node. - On the node, that endpoint (`internal/web/controller/server.go:68,271-277`) calls `ServerService.RestartXrayService()` (`internal/web/service/server.go:844-851`), which calls `XrayService.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 in `internal/web/job/xray_traffic_job.go` to a graceful per-user API reconcile. As of current `main` it has **not** been extended to the remote-node path above — `restartRemoteNodesOnDisable` still 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: 1. Check whether **Restart Xray After Auto Disable** is enabled on the master. If disabling it stops the freezes, that confirms this path. 2. On the *master*, check logs around an incident for `disableInvalidClients: restart xray on node <id> failed` (only logged if the remote restart call itself errored). 3. On the affected node, at the next occurrence, check whether Xray actually restarted around the time forwarding stopped — a new PID, a fresh "Xray ... started" line in the Xray log, or the `x-ui` service uptime — versus no restart attempt at all. *This reply was generated automatically; a maintainer may follow up.*
Author
Owner

@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 mirrors e5b56c94, 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.

<!-- gh-comment-id:4865443891 --> @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 mirrors e5b56c94, 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.
Author
Owner

@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.

<!-- gh-comment-id:4874285576 --> @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.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#3990
No description provided.