[GH-ISSUE #6870] [Bug]: Random Client Desynchronization Across Multiple Nodes Persists After Update #4561

Closed
opened 2026-10-31 20:40:32 +07:00 by bsakaguchi · 6 comments
Owner

Originally created by @Begamegazon on GitHub (Oct 18, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6870

Describe the bug

I previously reported an issue involving repeated setRemoteTraffic: node X lifecycle lift; marking dirty for re-push log messages and users being automatically disabled and re-enabled approximately every 6 seconds.

The issue was identified as a regression in v3.9.0 related to master-to-node synchronization. After the fix was released, I updated my installation, including the master and nodes, but the problem has not been fully resolved.

I am now experiencing intermittent client desynchronization across multiple nodes. Over time, approximately 2–3 clients out of my total of around 700 users become desynchronized per day.

The affected clients appear randomly across different nodes rather than being limited to a specific node. The issue develops over time, and I have not identified a consistent trigger or a reliable way to reproduce it.

This is particularly concerning because the master and nodes can become inconsistent regarding client information or state, potentially requiring manual investigation and correction.

Environment

Panel: Sanaei X-UI

Deployment: 1 master and 8 nodes

Total clients: Approximately 700

Update status: Updated to the version containing the reported fix

Affected nodes: Multiple nodes, seemingly at random

Frequency: Approximately 2–3 affected clients per day

How to reproduce the problem

Set up a Sanaei X-UI deployment with one master and 8 nodes.

Configure approximately 700 clients across the nodes.

Update the master and all nodes to the version containing the reported synchronization fix.

Run the deployment normally and allow the master and nodes to synchronize over time.

Monitor client synchronization and compare client information and status between the master and the corresponding nodes.

After some time, observe that approximately 2–3 clients per day become desynchronized on randomly affected nodes.

The issue occurs intermittently during normal operation. I have not identified a reliable way to trigger it manually, and the affected clients and nodes appear to vary.

Expected behavior

Client information and status should remain consistent between the master and all nodes after synchronization. The synchronization mechanism should reliably reconcile any differences without leaving clients in a desynchronized state.

Actual behavior

Despite updating to the version containing the fix, client desynchronization continues to occur intermittently. Approximately 2–3 clients per day become desynchronized across different nodes, with no obvious pattern.

Relevant logs


Screenshots

No response

3x-ui version

v3.10.2

Xray-core version

No response

How did you install 3x-ui?

install.sh script

Operating system

ubuntu 20.04

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?

No response

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 @Begamegazon on GitHub (Oct 18, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6870 ### Describe the bug I previously reported an issue involving repeated setRemoteTraffic: node X lifecycle lift; marking dirty for re-push log messages and users being automatically disabled and re-enabled approximately every 6 seconds. The issue was identified as a regression in v3.9.0 related to master-to-node synchronization. After the fix was released, I updated my installation, including the master and nodes, but the problem has not been fully resolved. I am now experiencing intermittent client desynchronization across multiple nodes. Over time, approximately 2–3 clients out of my total of around 700 users become desynchronized per day. The affected clients appear randomly across different nodes rather than being limited to a specific node. The issue develops over time, and I have not identified a consistent trigger or a reliable way to reproduce it. This is particularly concerning because the master and nodes can become inconsistent regarding client information or state, potentially requiring manual investigation and correction. Environment Panel: Sanaei X-UI Deployment: 1 master and 8 nodes Total clients: Approximately 700 Update status: Updated to the version containing the reported fix Affected nodes: Multiple nodes, seemingly at random Frequency: Approximately 2–3 affected clients per day ### How to reproduce the problem Set up a Sanaei X-UI deployment with one master and 8 nodes. Configure approximately 700 clients across the nodes. Update the master and all nodes to the version containing the reported synchronization fix. Run the deployment normally and allow the master and nodes to synchronize over time. Monitor client synchronization and compare client information and status between the master and the corresponding nodes. After some time, observe that approximately 2–3 clients per day become desynchronized on randomly affected nodes. The issue occurs intermittently during normal operation. I have not identified a reliable way to trigger it manually, and the affected clients and nodes appear to vary. ### Expected behavior Client information and status should remain consistent between the master and all nodes after synchronization. The synchronization mechanism should reliably reconcile any differences without leaving clients in a desynchronized state. ### Actual behavior Despite updating to the version containing the fix, client desynchronization continues to occur intermittently. Approximately 2–3 clients per day become desynchronized across different nodes, with no obvious pattern. ### Relevant logs ```shell ``` ### Screenshots _No response_ ### 3x-ui version v3.10.2 ### Xray-core version _No response_ ### How did you install 3x-ui? install.sh script ### Operating system ubuntu 20.04 ### 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? _No response_ ### 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:40:32 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@github-actions[bot] commented on GitHub (Oct 18, 2026):

I can't confirm a new bug yet. The report doesn't say what is actually different between the master and the node for an affected client, and node sync compares several separate fields. The fix from #6786 (2ffc694a, "fix(nodes): let a master's push and reconcile converge node inbounds") is in v3.10.0 and v3.10.2 (git tag --contains 2ffc694a), so with every panel on v3.10.2 that specific loop should be gone. Something else may still be wrong, but I need the details below to find it.

What the code already does about drift. On each traffic sync, the master treats its own client row as the authority for enable and expiryTime. It rewrites the node's copy (internal/web/service/client_locks.go:239, liftClientLifecycleInSettings):

// tr is the already-merged master row, authoritative in both directions:
// a lagging blob must not re-enable a disabled client either (#4917).
if nodeEnable, _ := cm["enable"].(bool); nodeEnable != tr.Enable {

After that it marks the node dirty so the reconcile job pushes again (internal/web/service/inbound_node.go:1461, log line setRemoteTraffic: node %d lifecycle lift; marking dirty for re-push). So a difference in enable or expiry should fix itself within a sync or two. A desync that lasts points to some other field, or to a push that fails. Without your data I can't tell which.

Please reply with:

  1. What exactly is out of sync for one affected client, as text, from both the master and the node: enable, expiry time, total/used traffic, and whether the client exists at all on the node. This tells me which code path is involved.
  2. Does it fix itself? Does it stay wrong until you change something by hand, and if so, what do you do to fix it (edit the client, restart the node, something else)?
  3. Logs from the master around the time a client goes out of sync. Lines starting with setRemoteTraffic:, plus any warning or error that names the node:
    journalctl -u x-ui --since "2 hours ago" | grep -iE "setRemoteTraffic|node|reconcile|push"
    
  4. Versions and token scope: confirm the master and all 8 nodes show v3.10.2 in the panel, and say which scope each node's API token has (admin, node-sync, ...).

Verdict: Insufficient information
Severity: N/A
Confidence: Medium
Root cause: Not established. The report doesn't say which field differs, and the known enable/expiry loop from #6786 is fixed in the version you run.
Same class: Not applicable
Already fixed: The #6786 loop is fixed by 2ffc694a, which is in v3.10.0 and v3.10.2. Other v3.10.x node-sync fixes include 2c5fc8e7 (an empty snapshot no longer deletes clients), dd956947, 6be3c438 and f8b72de9. The only commit after v3.10.2 is a8d0700b (token scope for panel updates), which doesn't change sync.
Duplicate of: Related: #6786
Evidence: client_locks.go:239-289 (master's enable/expiryTime overrides the node's copy); inbound_node.go:1456-1465 (marks the node dirty for a re-push); git tag --contains 2ffc694a → v3.10.0, v3.10.2.
Not determined: Which field drifts, and whether a re-push to the node fails or succeeds without applying. Answers 1 and 3 above would settle this.

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

<!-- gh-comment-id:6253161662 --> @github-actions[bot] commented on GitHub (Oct 18, 2026): I can't confirm a new bug yet. The report doesn't say what is actually different between the master and the node for an affected client, and node sync compares several separate fields. The fix from #6786 (`2ffc694a`, "fix(nodes): let a master's push and reconcile converge node inbounds") is in v3.10.0 and v3.10.2 (`git tag --contains 2ffc694a`), so with every panel on v3.10.2 that specific loop should be gone. Something else may still be wrong, but I need the details below to find it. **What the code already does about drift.** On each traffic sync, the master treats its own client row as the authority for `enable` and `expiryTime`. It rewrites the node's copy (`internal/web/service/client_locks.go:239`, `liftClientLifecycleInSettings`): ```go // tr is the already-merged master row, authoritative in both directions: // a lagging blob must not re-enable a disabled client either (#4917). if nodeEnable, _ := cm["enable"].(bool); nodeEnable != tr.Enable { ``` After that it marks the node dirty so the reconcile job pushes again (`internal/web/service/inbound_node.go:1461`, log line `setRemoteTraffic: node %d lifecycle lift; marking dirty for re-push`). So a difference in `enable` or expiry should fix itself within a sync or two. A desync that **lasts** points to some other field, or to a push that fails. Without your data I can't tell which. Please reply with: 1. **What exactly is out of sync** for one affected client, as text, from both the master and the node: `enable`, expiry time, total/used traffic, and whether the client exists at all on the node. This tells me which code path is involved. 2. **Does it fix itself?** Does it stay wrong until you change something by hand, and if so, what do you do to fix it (edit the client, restart the node, something else)? 3. **Logs from the master** around the time a client goes out of sync. Lines starting with `setRemoteTraffic:`, plus any warning or error that names the node: ``` journalctl -u x-ui --since "2 hours ago" | grep -iE "setRemoteTraffic|node|reconcile|push" ``` 4. **Versions and token scope**: confirm the master and all 8 nodes show v3.10.2 in the panel, and say which scope each node's API token has (`admin`, `node-sync`, ...). Verdict: Insufficient information Severity: N/A Confidence: Medium Root cause: Not established. The report doesn't say which field differs, and the known `enable`/expiry loop from #6786 is fixed in the version you run. Same class: Not applicable Already fixed: The #6786 loop is fixed by `2ffc694a`, which is in v3.10.0 and v3.10.2. Other v3.10.x node-sync fixes include `2c5fc8e7` (an empty snapshot no longer deletes clients), `dd956947`, `6be3c438` and `f8b72de9`. The only commit after v3.10.2 is `a8d0700b` (token scope for panel updates), which doesn't change sync. Duplicate of: Related: #6786 Evidence: `client_locks.go:239-289` (master's `enable`/`expiryTime` overrides the node's copy); `inbound_node.go:1456-1465` (marks the node dirty for a re-push); `git tag --contains 2ffc694a` → v3.10.0, v3.10.2. Not determined: Which field drifts, and whether a re-push to the node fails or succeeds without applying. Answers 1 and 3 above would settle this. _This reply was generated automatically; a maintainer may follow up._ <!-- claude-issue:analyst -->
Author
Owner

@Begamegazon commented on GitHub (Oct 18, 2026):

  1. What exactly is out of sync?

Here is a concrete example of the issue:

The affected client is enabled on the master and across all other nodes, but it is shown as disabled on node 8.

Master: Client is enabled.

Other nodes: Client is enabled.

Node 8: The same client is shown as disabled.

Because the client status differs between the master and node 8, the master repeatedly attempts to synchronize the client's status. The client appears to switch between enabled and disabled on the master every few seconds.

  1. Does it fix itself?

No. The issue does not resolve itself.

If I manually enable the affected client on node 8, it becomes disabled again automatically after a few seconds. The enabled state does not persist.

The only workaround I have found so far is to open the affected node, delete the desynchronized client from that node, and allow the synchronization mechanism to handle it afterward.

This behavior suggests that the node may be retaining or repeatedly restoring an incorrect client state, even after the master attempts to synchronize it.

<!-- gh-comment-id:6253304146 --> @Begamegazon commented on GitHub (Oct 18, 2026): 1. What exactly is out of sync? Here is a concrete example of the issue: The affected client is enabled on the master and across all other nodes, but it is shown as disabled on node 8. Master: Client is enabled. Other nodes: Client is enabled. Node 8: The same client is shown as disabled. Because the client status differs between the master and node 8, the master repeatedly attempts to synchronize the client's status. The client appears to switch between enabled and disabled on the master every few seconds. 2. Does it fix itself? No. The issue does not resolve itself. If I manually enable the affected client on node 8, it becomes disabled again automatically after a few seconds. The enabled state does not persist. The only workaround I have found so far is to open the affected node, delete the desynchronized client from that node, and allow the synchronization mechanism to handle it afterward. This behavior suggests that the node may be retaining or repeatedly restoring an incorrect client state, even after the master attempts to synchronize it.
Author
Owner

@github-actions[bot] commented on GitHub (Oct 18, 2026):

Thanks, this narrows it down. Node 8 is disabling the client on its own: its traffic job decides the client is used up or expired, even though the master doesn't. The master then re-enables it and pushes it back, and this repeats. I still can't say which limit node 8 thinks the client has hit. That depends on the values stored in node 8's database, and the two queries below will show them.

What the code shows

  1. Node 8 disables the client on every traffic tick. Every panel, including a node, runs disableInvalidClients (internal/web/service/inbound_disable.go:80). It disables any enabled client that matches this condition (inbound_disable.go:46-53):

    ((total > 0 AND up + down >= total)
    	OR (expiry_time > 0 AND expiry_time <= ?)
    	OR (total > 0 AND EXISTS (
    		SELECT 1 FROM client_global_traffics g
    		WHERE g.email = client_traffics.email
    			AND g.updated_at >= ?
    			AND g.up + g.down >= client_traffics.total
    	)))
    

    This explains why enabling the client by hand on node 8 doesn't stick. The next tick matches the same row and disables it again.

  2. The master's push can't clear the condition that matches. When the master pushes the client to node 8, the node updates only the client's limits and flags (UpdateClientStat, internal/web/service/inbound_traffic.go:619-636): enable, total, expiry_time, reset*. It does not touch up/down, and it does not touch the client_global_traffics rows. So if node 8's local up + down or a pushed global row is over total, re-pushing never fixes it.

  3. Why deleting the client works. Deleting the client on the node goes through DelClientStat (inbound_traffic.go:639-650). That deletes the client_traffics row and clears client_global_traffics for that email. The client then comes back with fresh counters. This supports the idea that node 8's stored counters, not the client's settings, are what's wrong.

  4. Why the master keeps switching. The master accepts a node's "disabled" report only when the node's expiry_time and total match its own (nodeDisableIsStale, internal/web/service/inbound_node.go:290-300). Its comment says: "Matching limits mean the node judged the client on the master's own terms: that verdict is genuine and still latches, as #4917 requires." Meanwhile the lift step treats the master's row as the source of truth and re-pushes (client_locks.go:274-278, then inbound_node.go:1461). So if the master and node 8 disagree on usage, the master and node keep overriding each other. That matches the switching you see.

What would settle it. On the master, the client's up + down is the total across all nodes, so node 8's local share should never be larger. If node 8 holds a larger up + down, or a global row over the quota, then a reset or renewal on the master never reached node 8. Which reset path missed it is the actual bug. Please run these while a client is stuck (install sqlite3 with apt install sqlite3 if needed), replacing CLIENT_EMAIL:

  1. On node 8:
    sqlite3 /etc/x-ui/x-ui.db "SELECT email, enable, up, down, total, expiry_time, reset, reset_day, reset_count FROM client_traffics WHERE email='CLIENT_EMAIL';"
    sqlite3 /etc/x-ui/x-ui.db "SELECT master_guid, up, down, updated_at FROM client_global_traffics WHERE email='CLIENT_EMAIL';"
    
  2. On the master, the same first query, so the two rows can be compared field by field.
  3. Recent changes to that client. Was it reset, renewed, or given a new quota or expiry shortly before it got stuck? Does it have auto-renew (reset / monthly / weekly) enabled? This shows which reset path to check.
  4. Still missing from my earlier request: the master's log lines for node 8 around the time it starts (journalctl -u x-ui --since "2 hours ago" | grep -iE "setRemoteTraffic|reset|node"), and confirmation that node 8 itself runs v3.10.2.

Verdict: Insufficient information
Severity: N/A
Confidence: Medium
Root cause: Narrowed but not established. Node 8's own disableInvalidClients (inbound_disable.go:80) keeps disabling the client, and the master's re-push can't clear that because UpdateClientStat (inbound_traffic.go:619) never resets up/down or client_global_traffics. Which of the three conditions in depletedClientsCond matches, and why node 8's stored counters differ from the master's, is unknown.
Same class: Not applicable until the matching condition is known
Already fixed: Not applicable. The only commit after v3.10.2 is a8d0700b (token scope), which doesn't change sync.
Duplicate of: Related: #6786, #4917, #6113
Evidence: inbound_disable.go:46-53 (depleted condition, including the global-traffic check); inbound_traffic.go:619-636 (a push updates limits and flags, not counters); inbound_traffic.go:639-650 (deleting clears both tables, which is why the workaround works); inbound_node.go:290-300 (nodeDisableIsStale, the master accepts a node's disable when limits match); client_locks.go:274-278 and inbound_node.go:1461 (lift and re-push).
Not determined: Whether node 8's up + down, expiry_time, or a client_global_traffics row matches the condition. The two node-8 queries above settle this.

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

<!-- gh-comment-id:6253337618 --> @github-actions[bot] commented on GitHub (Oct 18, 2026): Thanks, this narrows it down. Node 8 is disabling the client **on its own**: its traffic job decides the client is used up or expired, even though the master doesn't. The master then re-enables it and pushes it back, and this repeats. I still can't say which limit node 8 thinks the client has hit. That depends on the values stored in node 8's database, and the two queries below will show them. **What the code shows** 1. **Node 8 disables the client on every traffic tick.** Every panel, including a node, runs `disableInvalidClients` (`internal/web/service/inbound_disable.go:80`). It disables any enabled client that matches this condition (`inbound_disable.go:46-53`): ```sql ((total > 0 AND up + down >= total) OR (expiry_time > 0 AND expiry_time <= ?) OR (total > 0 AND EXISTS ( SELECT 1 FROM client_global_traffics g WHERE g.email = client_traffics.email AND g.updated_at >= ? AND g.up + g.down >= client_traffics.total ))) ``` This explains why enabling the client by hand on node 8 doesn't stick. The next tick matches the same row and disables it again. 2. **The master's push can't clear the condition that matches.** When the master pushes the client to node 8, the node updates only the client's limits and flags (`UpdateClientStat`, `internal/web/service/inbound_traffic.go:619-636`): `enable`, `total`, `expiry_time`, `reset*`. It does not touch `up`/`down`, and it does not touch the `client_global_traffics` rows. So if node 8's local `up + down` or a pushed global row is over `total`, re-pushing never fixes it. 3. **Why deleting the client works.** Deleting the client on the node goes through `DelClientStat` (`inbound_traffic.go:639-650`). That deletes the `client_traffics` row **and** clears `client_global_traffics` for that email. The client then comes back with fresh counters. This supports the idea that node 8's stored counters, not the client's settings, are what's wrong. 4. **Why the master keeps switching.** The master accepts a node's "disabled" report only when the node's `expiry_time` and `total` match its own (`nodeDisableIsStale`, `internal/web/service/inbound_node.go:290-300`). Its comment says: "Matching limits mean the node judged the client on the master's own terms: that verdict is genuine and still latches, as #4917 requires." Meanwhile the lift step treats the master's row as the source of truth and re-pushes (`client_locks.go:274-278`, then `inbound_node.go:1461`). So if the master and node 8 disagree on usage, the master and node keep overriding each other. That matches the switching you see. **What would settle it.** On the master, the client's `up + down` is the total across all nodes, so node 8's local share should never be larger. If node 8 holds a larger `up + down`, or a global row over the quota, then a reset or renewal on the master never reached node 8. Which reset path missed it is the actual bug. Please run these while a client is stuck (install `sqlite3` with `apt install sqlite3` if needed), replacing `CLIENT_EMAIL`: 1. **On node 8:** ``` sqlite3 /etc/x-ui/x-ui.db "SELECT email, enable, up, down, total, expiry_time, reset, reset_day, reset_count FROM client_traffics WHERE email='CLIENT_EMAIL';" sqlite3 /etc/x-ui/x-ui.db "SELECT master_guid, up, down, updated_at FROM client_global_traffics WHERE email='CLIENT_EMAIL';" ``` 2. **On the master**, the same first query, so the two rows can be compared field by field. 3. **Recent changes to that client.** Was it reset, renewed, or given a new quota or expiry shortly before it got stuck? Does it have auto-renew (`reset` / monthly / weekly) enabled? This shows which reset path to check. 4. **Still missing from my earlier request:** the master's log lines for node 8 around the time it starts (`journalctl -u x-ui --since "2 hours ago" | grep -iE "setRemoteTraffic|reset|node"`), and confirmation that node 8 itself runs v3.10.2. Verdict: Insufficient information Severity: N/A Confidence: Medium Root cause: Narrowed but not established. Node 8's own `disableInvalidClients` (`inbound_disable.go:80`) keeps disabling the client, and the master's re-push can't clear that because `UpdateClientStat` (`inbound_traffic.go:619`) never resets `up`/`down` or `client_global_traffics`. Which of the three conditions in `depletedClientsCond` matches, and why node 8's stored counters differ from the master's, is unknown. Same class: Not applicable until the matching condition is known Already fixed: Not applicable. The only commit after v3.10.2 is `a8d0700b` (token scope), which doesn't change sync. Duplicate of: Related: #6786, #4917, #6113 Evidence: `inbound_disable.go:46-53` (depleted condition, including the global-traffic check); `inbound_traffic.go:619-636` (a push updates limits and flags, not counters); `inbound_traffic.go:639-650` (deleting clears both tables, which is why the workaround works); `inbound_node.go:290-300` (`nodeDisableIsStale`, the master accepts a node's disable when limits match); `client_locks.go:274-278` and `inbound_node.go:1461` (lift and re-push). Not determined: Whether node 8's `up + down`, `expiry_time`, or a `client_global_traffics` row matches the condition. The two node-8 queries above settle this. _This reply was generated automatically; a maintainer may follow up._ <!-- claude-issue:analyst -->
Author
Owner

@Begamegazon commented on GitHub (Oct 18, 2026):

Here are the database query results for an affected client (ariana23ranjbar) from node 8, where the client is incorrectly disabled.

1. client_traffics on node 8

email: ariana23ranjbar
enable: 0
up: 9867
down: 35388
total: 34989172213
expiry_time: 1795015183420
reset: 0
reset_day: 0
reset_count: 0

2. client_global_traffics on node 8

master_guid: 588885ca-3649-4ef3-9bfc-7589509840b2
up: 21456695
down: 127120688
updated_at: 1792347820279

The client is disabled on node 8 (enable = 0), and manually enabling it does not persist. It becomes disabled again after a few seconds.

Unfortunately, my master uses PostgreSQL rather than SQLite, so I have not yet retrieved the equivalent database records from the master for comparison.

<!-- gh-comment-id:6253539910 --> @Begamegazon commented on GitHub (Oct 18, 2026): Here are the database query results for an affected client (`ariana23ranjbar`) from **node 8**, where the client is incorrectly disabled. **1. `client_traffics` on node 8** ```text email: ariana23ranjbar enable: 0 up: 9867 down: 35388 total: 34989172213 expiry_time: 1795015183420 reset: 0 reset_day: 0 reset_count: 0 ``` **2. `client_global_traffics` on node 8** ```text master_guid: 588885ca-3649-4ef3-9bfc-7589509840b2 up: 21456695 down: 127120688 updated_at: 1792347820279 ``` The client is disabled on node 8 (`enable = 0`), and manually enabling it does not persist. It becomes disabled again after a few seconds. Unfortunately, my master uses PostgreSQL rather than SQLite, so I have not yet retrieved the equivalent database records from the master for comparison.
Author
Owner

@github-actions[bot] commented on GitHub (Oct 18, 2026):

Your node-8 numbers rule out what I suggested last time. Node 8's own traffic job cannot have disabled this client. The likely cause is the master side: it accepts a "disabled" report from a node whenever quota and expiry match, even if its own numbers say the client is fine. It then pushes that state back, so the client stays stuck.

Your values against node 8's disable condition (depletedClientsCond, internal/web/service/inbound_disable.go:46-53):

Condition Your value Matches?
total > 0 AND up + down >= total 9,867 + 35,388 = 45,255 vs 34,989,172,213 no
expiry_time > 0 AND expiry_time <= now 1795015183420 (about 2026-11-18) no, still in the future
g.up + g.down >= total (global row, fresh) 21,456,695 + 127,120,688 = 148,577,383 vs 34,989,172,213 no

So disableInvalidClients (inbound_disable.go:80) does not select this row, and the enable = 0 came from somewhere else. On a node, the other writer of client_traffics.enable during normal sync is the master's inbound push. The master calls panel/api/inbounds/update/:id (internal/web/runtime/remote.go:472), and the node copies the pushed client's enable into the row through UpdateClientStat (internal/web/service/inbound.go:2438 → inbound_traffic.go:619-636).

Why the master keeps the bad state. When node 8 reports enable = false, the master decides whether to accept it here (internal/web/service/inbound_node.go:290-300):

// Matching limits mean the node judged the client on the master's own terms:
// that verdict is genuine and still latches, as #4917 requires.
if node.ExpiryTime == master.ExpiryTime && node.Total == master.Total {
	return false
}
return masterLimitsAllowClient(master, now, deltaUp, deltaDown)

When the limits match, it returns "not stale" before it checks masterLimitsAllowClient. The merge then disables the master's row (inbound_node.go:1178-1179, and the ELSE 0 / ELSE false branch of ClientTrafficEnableMergeExpr, internal/database/dialect.go:42-58). After that, liftClientLifecycleInSettings (internal/web/service/client_locks.go:274-278) treats the master row as the source of truth and re-pushes enable = false to the node (inbound_node.go:1461).

The comment's assumption is that an enable = false with matching limits must come from the node's depletion job. Your row shows that assumption is false: the limits match, yet no depletion branch can produce false. Once such a false reaches node 8, by any route, nothing clears it. That fits what you see:

  • Enabling the client on node 8 doesn't stick, because the next master push or merge restores false.
  • Deleting the client on node 8 works, because DelClientStat (inbound_traffic.go:639-650) removes the row, and the client comes back fresh.

Workaround until this is addressed: delete and re-sync the client on the affected node, as you are already doing.

Verdict: Confirmed bug
Severity: High
Confidence: Medium
Root cause: nodeDisableIsStale, internal/web/service/inbound_node.go:296-298. Whenever a node reports enable=false with expiry_time/total equal to the master's, the master accepts it unconditionally, even when masterLimitsAllowClient (inbound_node.go:275-286) says the master's limits still allow the client. The latch was introduced in 6f7a3052 "fix(node): stop stale expiry sync from undoing client extensions (#6228) (#6231)".
Same class: ClientTrafficEnableMergeExpr (internal/database/dialect.go:44-58) encodes the same rule in SQL (it re-enables only when limits differ). liftClientLifecycleInSettings (client_locks.go:276-278) then propagates the latched value back to the node. applyMasterClientLifecycle (inbound_node.go:323-324) copies the latched master.Enable into the client record.
Already fixed: Still present on the default branch. The only commit after v3.10.2 is a8d0700b (token scope), which doesn't touch sync.
Duplicate of: Related: #6786, #6228, #4917
Evidence: Reporter's node-8 row checked against inbound_disable.go:46-53 (no branch matches). inbound_node.go:296-298 (limit-match short-circuit), inbound_node.go:1178-1179 (master latches the node's false), client_locks.go:274-278 + inbound_node.go:1461 (re-push of the latched value), inbound_traffic.go:619-636 (push writes enable on the node), inbound_traffic.go:639-650 (delete clears the row, hence the workaround).
Not determined: How the first enable=false reached node 8. Candidates are a master push that carried false (an earlier depletion or manual disable on the master, re-enabled later), clock skew around expiry, or a push skipped by the reconcile fingerprint cache (remote.go:499-506). Also undetermined is what flips the master back to enabled every few seconds. The master's client_traffics row for this email (SELECT email, enable, up, down, total, expiry_time FROM client_traffics WHERE email='ariana23ranjbar'; in psql), plus master log lines containing setRemoteTraffic for node 8, would show both.

Suggested fix: In nodeDisableIsStale, consult masterLimitsAllowClient even when the limits match. A node false that the master's own counters, quota and deadline cannot explain should not latch, while a genuine combined-quota or expiry disable still does (#4917). The SQL CASE in ClientTrafficEnableMergeExpr must change the same way, or the Go prediction at inbound_node.go:1178 and the actual UPDATE will disagree.

@MHSanaei: confirmed node-sync bug. A node-reported enable=false with matching limits is latched by the master even when the master's own limits allow the client, which leaves clients stuck disabled on a node.

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

<!-- gh-comment-id:6253565985 --> @github-actions[bot] commented on GitHub (Oct 18, 2026): Your node-8 numbers rule out what I suggested last time. Node 8's own traffic job **cannot** have disabled this client. The likely cause is the master side: it accepts a "disabled" report from a node whenever quota and expiry match, even if its own numbers say the client is fine. It then pushes that state back, so the client stays stuck. **Your values against node 8's disable condition** (`depletedClientsCond`, `internal/web/service/inbound_disable.go:46-53`): | Condition | Your value | Matches? | |---|---|---| | `total > 0 AND up + down >= total` | 9,867 + 35,388 = 45,255 vs 34,989,172,213 | no | | `expiry_time > 0 AND expiry_time <= now` | 1795015183420 (about 2026-11-18) | no, still in the future | | `g.up + g.down >= total` (global row, fresh) | 21,456,695 + 127,120,688 = 148,577,383 vs 34,989,172,213 | no | So `disableInvalidClients` (`inbound_disable.go:80`) does not select this row, and the `enable = 0` came from somewhere else. On a node, the other writer of `client_traffics.enable` during normal sync is the master's inbound push. The master calls `panel/api/inbounds/update/:id` (`internal/web/runtime/remote.go:472`), and the node copies the pushed client's `enable` into the row through `UpdateClientStat` (`internal/web/service/inbound.go:2438` → `inbound_traffic.go:619-636`). **Why the master keeps the bad state.** When node 8 reports `enable = false`, the master decides whether to accept it here (`internal/web/service/inbound_node.go:290-300`): ```go // Matching limits mean the node judged the client on the master's own terms: // that verdict is genuine and still latches, as #4917 requires. if node.ExpiryTime == master.ExpiryTime && node.Total == master.Total { return false } return masterLimitsAllowClient(master, now, deltaUp, deltaDown) ``` When the limits match, it returns "not stale" **before** it checks `masterLimitsAllowClient`. The merge then disables the master's row (`inbound_node.go:1178-1179`, and the `ELSE 0` / `ELSE false` branch of `ClientTrafficEnableMergeExpr`, `internal/database/dialect.go:42-58`). After that, `liftClientLifecycleInSettings` (`internal/web/service/client_locks.go:274-278`) treats the master row as the source of truth and re-pushes `enable = false` to the node (`inbound_node.go:1461`). The comment's assumption is that an `enable = false` with matching limits must come from the node's depletion job. Your row shows that assumption is false: the limits match, yet no depletion branch can produce `false`. Once such a `false` reaches node 8, by any route, nothing clears it. That fits what you see: - Enabling the client on node 8 doesn't stick, because the next master push or merge restores `false`. - Deleting the client on node 8 works, because `DelClientStat` (`inbound_traffic.go:639-650`) removes the row, and the client comes back fresh. **Workaround** until this is addressed: delete and re-sync the client on the affected node, as you are already doing. Verdict: Confirmed bug Severity: High Confidence: Medium Root cause: `nodeDisableIsStale`, `internal/web/service/inbound_node.go:296-298`. Whenever a node reports `enable=false` with `expiry_time`/`total` equal to the master's, the master accepts it unconditionally, even when `masterLimitsAllowClient` (`inbound_node.go:275-286`) says the master's limits still allow the client. The latch was introduced in `6f7a3052` "fix(node): stop stale expiry sync from undoing client extensions (#6228) (#6231)". Same class: `ClientTrafficEnableMergeExpr` (`internal/database/dialect.go:44-58`) encodes the same rule in SQL (it re-enables only when limits differ). `liftClientLifecycleInSettings` (`client_locks.go:276-278`) then propagates the latched value back to the node. `applyMasterClientLifecycle` (`inbound_node.go:323-324`) copies the latched `master.Enable` into the client record. Already fixed: Still present on the default branch. The only commit after v3.10.2 is `a8d0700b` (token scope), which doesn't touch sync. Duplicate of: Related: #6786, #6228, #4917 Evidence: Reporter's node-8 row checked against `inbound_disable.go:46-53` (no branch matches). `inbound_node.go:296-298` (limit-match short-circuit), `inbound_node.go:1178-1179` (master latches the node's false), `client_locks.go:274-278` + `inbound_node.go:1461` (re-push of the latched value), `inbound_traffic.go:619-636` (push writes `enable` on the node), `inbound_traffic.go:639-650` (delete clears the row, hence the workaround). Not determined: How the **first** `enable=false` reached node 8. Candidates are a master push that carried `false` (an earlier depletion or manual disable on the master, re-enabled later), clock skew around expiry, or a push skipped by the reconcile fingerprint cache (`remote.go:499-506`). Also undetermined is what flips the master back to enabled every few seconds. The master's `client_traffics` row for this email (`SELECT email, enable, up, down, total, expiry_time FROM client_traffics WHERE email='ariana23ranjbar';` in `psql`), plus master log lines containing `setRemoteTraffic` for node 8, would show both. Suggested fix: In `nodeDisableIsStale`, consult `masterLimitsAllowClient` even when the limits match. A node `false` that the master's own counters, quota and deadline cannot explain should not latch, while a genuine combined-quota or expiry disable still does (#4917). The SQL CASE in `ClientTrafficEnableMergeExpr` must change the same way, or the Go prediction at `inbound_node.go:1178` and the actual UPDATE will disagree. @MHSanaei: confirmed node-sync bug. A node-reported `enable=false` with matching limits is latched by the master even when the master's own limits allow the client, which leaves clients stuck disabled on a node. _This reply was generated automatically; a maintainer may follow up._ <!-- claude-issue:analyst -->
Author
Owner

@Begamegazon commented on GitHub (Oct 19, 2026):

Additional Update: Inconsistent Desynchronization Behavior Across Nodes

I would like to provide an additional clarification regarding the issue.

The desynchronization behavior is random and varies across different nodes and clients.

I have observed two different scenarios:

Scenario 1: Client status desynchronization only

The client's traffic usage and expiry time are synchronized correctly between the master and the affected node.

However, the client is incorrectly shown as disabled on the affected node, even though it is enabled on the master and other nodes.

Manually enabling the client on the affected node does not resolve the issue, as it becomes disabled again after a few seconds.

Scenario 2: Client status and data desynchronization

On some other nodes, different affected clients experience desynchronization not only in their enabled/disabled status but also in their traffic usage and expiry time.

In these cases, the client's traffic counters and/or expiry time differ between the master and the affected node, in addition to the enable/disable issue.

These problems occur randomly. The affected clients and nodes vary, and I have not identified a consistent pattern or a reliable way to reproduce the issue.

This suggests that there may be more than one synchronization failure involved, or that the same underlying issue affects different client fields under different circumstances.

<!-- gh-comment-id:6268634339 --> @Begamegazon commented on GitHub (Oct 19, 2026): Additional Update: Inconsistent Desynchronization Behavior Across Nodes I would like to provide an additional clarification regarding the issue. The desynchronization behavior is random and varies across different nodes and clients. I have observed two different scenarios: Scenario 1: Client status desynchronization only The client's traffic usage and expiry time are synchronized correctly between the master and the affected node. However, the client is incorrectly shown as disabled on the affected node, even though it is enabled on the master and other nodes. Manually enabling the client on the affected node does not resolve the issue, as it becomes disabled again after a few seconds. Scenario 2: Client status and data desynchronization On some other nodes, different affected clients experience desynchronization not only in their enabled/disabled status but also in their traffic usage and expiry time. In these cases, the client's traffic counters and/or expiry time differ between the master and the affected node, in addition to the enable/disable issue. These problems occur randomly. The affected clients and nodes vary, and I have not identified a consistent pattern or a reliable way to reproduce the issue. This suggests that there may be more than one synchronization failure involved, or that the same underlying issue affects different client fields under different circumstances.
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#4561
No description provided.