[GH-ISSUE #6749] [Bug]: Node Sync may delete and recreate an existing node inbound, causing client traffic history to reset to 0 #4498

Closed
opened 2026-10-31 20:40:04 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @hoseyny6223-netizen on GitHub (Oct 6, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6749

Describe the bug

Bug: Node Sync may delete and recreate an existing node inbound, causing client traffic history to reset to 0

Environment

  • 3x-ui: v3.9.0 (3cd4bf5)
  • Xray-core: 26.9.30
  • Master OS: Linux
  • Node OS: Linux
  • Database: PostgreSQL
  • Master and Node: both running v3.9.0
  • Node ID: 2
  • Node name: kharej

Summary

We observed a serious Node Sync issue where an existing Node inbound appears to be deleted from the Master database and later recreated/adopted as a new inbound.

The affected inbound was:

Old Master inbound:
ID: 20
Remark: proxy
Port: 2053
Protocol: VLESS
Node: 2

The Node-side inbound itself was not recreated or deleted. It remained the same proxy / 2053 inbound on the Node.

Later, the Master contained:

New Master inbound:
ID: 24
Remark: proxy
Port: 2053
Protocol: VLESS
Node: 2
Tag: n2-in-2053-tcp
OriginNodeGUID: 455af326-759f-43af-b802-134756af1f4e

Inbound 20 no longer exists.

Because PostgreSQL generated a new inbound ID (24), this does not appear to be a normal update/edit of inbound 20.

Observed traffic behavior

The most important symptom is that actual Xray/Node traffic was NOT lost.

The Node still had real cumulative traffic for the clients.

The inbound-level traffic on the Master was also still present and showed approximately 499+ GB.

However, several affected clients had their Master client_traffics reset to:

up = 0
down = 0

while the Node still reported substantial traffic.

Examples:

Client: Baba
Master: 0 / 0
Node: 55,025,247 / 2,201,244,936

Client: Hexa_418825
Master: 0 / 0
Node: 2,514,468,533 / 13,163,219,073

Client: Hexa_803441
Master: 0 / 0
Node: 2,546,865,020 / 27,485,552,747

Client: Hexa_802088
Master: 0 / 0
Node: 1,717,062,187 / 13,710,059,742

Other affected clients showed the same pattern.

This means the actual Xray traffic counters were not reset; the problem appears to be the Master-side client traffic history/accounting lifecycle.

Database evidence

The Master database currently contains:

24 | proxy | 2053 | vless | node 2 | n2-in-2053-tcp
25 | WS German | 443 | vless | node 2 | n2-in-443-tcp

Inbound 20 is gone.

The PostgreSQL sequence is:

inbounds_id_seq = 25

There are no custom PostgreSQL triggers on:

  • inbounds
  • client_inbounds
  • clients
  • client_traffics
  • node_client_traffics

The affected client_traffics rows are newer rows with 0/0, while some unaffected clients still have older traffic rows with their historical values.

Relevant Node Sync log

Around the incident there was also:

Oct 06 00:23:07 ... WARNING - node traffic sync: fetch from kharej failed:
GET "https://kharej.khkhooneh.ir:2083/Reza/panel/api/inbounds/list":
dial tcp 46.224.169.74:2083: connect: connection refused

We do NOT assume that this specific failed request directly caused the deletion, because the v3.9.0 code returns from FetchTrafficSnapshot() when the fetch fails.

The concern is instead a possible Node Sync race/inconsistent snapshot during the inbound reconciliation/traffic-sync lifecycle.

Why we suspect Node Sync

In internal/web/service/inbound_node.go, SetRemoteTraffic() contains logic that removes a central inbound when:

  1. the Node returns a successful, non-empty snapshot;
  2. the central inbound is enabled;
  3. the inbound tag is not present in the Node snapshot.

The code logs:

setRemoteTraffic: node %d no longer reports inbound %q
— removing it centrally

and then removes the central inbound and can remove associated client_traffics history.

If the inbound appears again in a subsequent Node snapshot, the Master can create/adopt it again.

This would explain the observed lifecycle:

Master inbound 20
        ↓
Node Sync snapshot temporarily does not contain the inbound
        ↓
Master considers inbound 20 stale
        ↓
Inbound 20 is removed
        ↓
Associated client traffic history is removed
        ↓
Later Node snapshot reports the inbound again
        ↓
Master creates/adopts a new inbound
        ↓
New inbound ID = 24

We cannot prove from historical DB data exactly why the inbound tag was missing from the snapshot at that moment, because the historical snapshot itself was not persisted.

Additional observation

We repeated the bulk operation that initially appeared suspicious: adding the same Node inbound to multiple clients simultaneously.

The second test did not reproduce the traffic reset.

Therefore we currently do not believe that simply bulk-attaching an inbound to multiple clients is sufficient to trigger the problem.

It may instead interact with Node Sync / ConfigDirty / reconciliation timing.

Expected behavior

A temporary incomplete or inconsistent Node snapshot should not delete an existing Master inbound and its client traffic history.

If the Node is temporarily unavailable, restarting, reloading Xray, reconciling configuration, or returning an incomplete snapshot, the Master should preserve the existing inbound and its traffic history until the Node state is positively confirmed.

In particular, a transient missing inbound should not result in:

DELETE central inbound
+
DELETE client traffic history

Actual behavior

An existing Node inbound appears to have gone through:

Master ID 20
    ↓
removed
    ↓
same Node inbound appears again
    ↓
Master ID 24

with client-level Master traffic becoming 0/0 for multiple affected clients while Node/Xray traffic remained intact.

Potential impact

This is particularly serious for clients with finite traffic quotas.

The Master uses client traffic accounting for quota enforcement and disabling depleted clients.

If historical traffic is replaced by 0/0, a client that has already consumed a large amount of traffic may temporarily appear to have unused quota.

For example:

Actual Node usage: tens of GB
Master client traffic: 0 GB

This can potentially affect quota enforcement and client enable/disable state.

Request

Please investigate whether the Node Sync / SetRemoteTraffic() inbound stale-removal logic can incorrectly remove an existing Node inbound when a snapshot is temporarily incomplete or inconsistent.

In particular:

  1. Can FetchTrafficSnapshot() ever return a successful but incomplete inbound list?
  2. Can ReconcileNode() / ConfigDirty / Xray reload timing produce a snapshot where an existing inbound is temporarily missing?
  3. Can the stale-inbound sweep in SetRemoteTraffic() delete the central inbound too aggressively?
  4. Can deletion of that inbound remove client_traffics history that should be preserved?
  5. Should an inbound be required to be missing from multiple consecutive successful snapshots before being removed?
  6. Should an existing inbound with the same origin_node_guid + port + protocol/listen be preserved/adopted instead of being deleted/recreated?
  7. Could the Master preserve client traffic history across this inbound lifecycle even if the central inbound has to be recreated?

The issue was observed on the latest stable release:

3x-ui v3.9.0
commit 3cd4bf5
Xray 26.9.30
PostgreSQL
Master + Node both v3.9.0

All domains, tokens, UUIDs and other sensitive identifiers have been redacted.

How to reproduce the problem

The issue could not be reproduced deterministically, but the following sequence reproduces the conditions under which the problem occurred:

  1. Set up a Sanaei v3.9.0 Master and Node, both running Xray 26.9.30, with PostgreSQL on the Master.

  2. Create a Node inbound on the Master and synchronize/deploy it to the Node.

  3. Attach multiple existing clients, which already have traffic history, to this Node inbound.

  4. Allow the clients to generate traffic and confirm that:

    • The Node/Xray reports non-zero traffic for the clients.
    • The Master contains corresponding client traffic history.
  5. Allow the normal Node Traffic Sync / reconciliation process to run.

  6. During the affected incident, the original Master inbound (ID 20) disappeared from the Master database, even though the corresponding inbound on the Node was not recreated or removed.

  7. After a subsequent synchronization, the same Node inbound appeared again on the Master with a new inbound ID (ID 24).

  8. After this lifecycle, multiple affected clients had their Master-side client_traffics reset to 0 / 0, while the Node still reported their actual cumulative traffic.

  9. Repeating the bulk client-to-inbound attachment operation alone did not reproduce the issue consistently. This suggests that the problem is timing-dependent and related to Node Traffic Sync / reconciliation or a transient/incomplete Node snapshot.

The issue appears to require a specific synchronization/reconciliation timing condition rather than being triggered by the client attachment operation alone.

Expected behavior

No response

Actual behavior

No response

Relevant logs


Screenshots

No response

3x-ui version

3.9.0

Xray-core version

26.9.30

How did you install 3x-ui?

install.sh script

Operating system

ubuntu 24.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?

None

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 @hoseyny6223-netizen on GitHub (Oct 6, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6749 ### Describe the bug ## Bug: Node Sync may delete and recreate an existing node inbound, causing client traffic history to reset to 0 ### Environment * 3x-ui: **v3.9.0** (`3cd4bf5`) * Xray-core: **26.9.30** * Master OS: Linux * Node OS: Linux * Database: **PostgreSQL** * Master and Node: both running **v3.9.0** * Node ID: `2` * Node name: `kharej` ### Summary We observed a serious Node Sync issue where an existing Node inbound appears to be deleted from the Master database and later recreated/adopted as a new inbound. The affected inbound was: ```text Old Master inbound: ID: 20 Remark: proxy Port: 2053 Protocol: VLESS Node: 2 ``` The Node-side inbound itself was not recreated or deleted. It remained the same `proxy` / `2053` inbound on the Node. Later, the Master contained: ```text New Master inbound: ID: 24 Remark: proxy Port: 2053 Protocol: VLESS Node: 2 Tag: n2-in-2053-tcp OriginNodeGUID: 455af326-759f-43af-b802-134756af1f4e ``` Inbound `20` no longer exists. Because PostgreSQL generated a new inbound ID (`24`), this does not appear to be a normal update/edit of inbound `20`. ### Observed traffic behavior The most important symptom is that actual Xray/Node traffic was NOT lost. The Node still had real cumulative traffic for the clients. The inbound-level traffic on the Master was also still present and showed approximately **499+ GB**. However, several affected clients had their Master `client_traffics` reset to: ```text up = 0 down = 0 ``` while the Node still reported substantial traffic. Examples: ```text Client: Baba Master: 0 / 0 Node: 55,025,247 / 2,201,244,936 Client: Hexa_418825 Master: 0 / 0 Node: 2,514,468,533 / 13,163,219,073 Client: Hexa_803441 Master: 0 / 0 Node: 2,546,865,020 / 27,485,552,747 Client: Hexa_802088 Master: 0 / 0 Node: 1,717,062,187 / 13,710,059,742 ``` Other affected clients showed the same pattern. This means the actual Xray traffic counters were not reset; the problem appears to be the Master-side client traffic history/accounting lifecycle. ### Database evidence The Master database currently contains: ```text 24 | proxy | 2053 | vless | node 2 | n2-in-2053-tcp 25 | WS German | 443 | vless | node 2 | n2-in-443-tcp ``` Inbound `20` is gone. The PostgreSQL sequence is: ```text inbounds_id_seq = 25 ``` There are no custom PostgreSQL triggers on: * `inbounds` * `client_inbounds` * `clients` * `client_traffics` * `node_client_traffics` The affected `client_traffics` rows are newer rows with `0/0`, while some unaffected clients still have older traffic rows with their historical values. ### Relevant Node Sync log Around the incident there was also: ```text Oct 06 00:23:07 ... WARNING - node traffic sync: fetch from kharej failed: GET "https://kharej.khkhooneh.ir:2083/Reza/panel/api/inbounds/list": dial tcp 46.224.169.74:2083: connect: connection refused ``` We do NOT assume that this specific failed request directly caused the deletion, because the v3.9.0 code returns from `FetchTrafficSnapshot()` when the fetch fails. The concern is instead a possible Node Sync race/inconsistent snapshot during the inbound reconciliation/traffic-sync lifecycle. ### Why we suspect Node Sync In `internal/web/service/inbound_node.go`, `SetRemoteTraffic()` contains logic that removes a central inbound when: 1. the Node returns a successful, non-empty snapshot; 2. the central inbound is enabled; 3. the inbound tag is not present in the Node snapshot. The code logs: ```text setRemoteTraffic: node %d no longer reports inbound %q — removing it centrally ``` and then removes the central inbound and can remove associated `client_traffics` history. If the inbound appears again in a subsequent Node snapshot, the Master can create/adopt it again. This would explain the observed lifecycle: ```text Master inbound 20 ↓ Node Sync snapshot temporarily does not contain the inbound ↓ Master considers inbound 20 stale ↓ Inbound 20 is removed ↓ Associated client traffic history is removed ↓ Later Node snapshot reports the inbound again ↓ Master creates/adopts a new inbound ↓ New inbound ID = 24 ``` We cannot prove from historical DB data exactly why the inbound tag was missing from the snapshot at that moment, because the historical snapshot itself was not persisted. ### Additional observation We repeated the bulk operation that initially appeared suspicious: adding the same Node inbound to multiple clients simultaneously. The second test did **not** reproduce the traffic reset. Therefore we currently do not believe that simply bulk-attaching an inbound to multiple clients is sufficient to trigger the problem. It may instead interact with Node Sync / `ConfigDirty` / reconciliation timing. ### Expected behavior A temporary incomplete or inconsistent Node snapshot should **not delete an existing Master inbound and its client traffic history**. If the Node is temporarily unavailable, restarting, reloading Xray, reconciling configuration, or returning an incomplete snapshot, the Master should preserve the existing inbound and its traffic history until the Node state is positively confirmed. In particular, a transient missing inbound should not result in: ```text DELETE central inbound + DELETE client traffic history ``` ### Actual behavior An existing Node inbound appears to have gone through: ```text Master ID 20 ↓ removed ↓ same Node inbound appears again ↓ Master ID 24 ``` with client-level Master traffic becoming `0/0` for multiple affected clients while Node/Xray traffic remained intact. ### Potential impact This is particularly serious for clients with finite traffic quotas. The Master uses client traffic accounting for quota enforcement and disabling depleted clients. If historical traffic is replaced by `0/0`, a client that has already consumed a large amount of traffic may temporarily appear to have unused quota. For example: ```text Actual Node usage: tens of GB Master client traffic: 0 GB ``` This can potentially affect quota enforcement and client enable/disable state. ### Request Please investigate whether the Node Sync / `SetRemoteTraffic()` inbound stale-removal logic can incorrectly remove an existing Node inbound when a snapshot is temporarily incomplete or inconsistent. In particular: 1. Can `FetchTrafficSnapshot()` ever return a successful but incomplete inbound list? 2. Can `ReconcileNode()` / `ConfigDirty` / Xray reload timing produce a snapshot where an existing inbound is temporarily missing? 3. Can the stale-inbound sweep in `SetRemoteTraffic()` delete the central inbound too aggressively? 4. Can deletion of that inbound remove `client_traffics` history that should be preserved? 5. Should an inbound be required to be missing from multiple consecutive successful snapshots before being removed? 6. Should an existing inbound with the same `origin_node_guid` + port + protocol/listen be preserved/adopted instead of being deleted/recreated? 7. Could the Master preserve client traffic history across this inbound lifecycle even if the central inbound has to be recreated? The issue was observed on the latest stable release: ```text 3x-ui v3.9.0 commit 3cd4bf5 Xray 26.9.30 PostgreSQL Master + Node both v3.9.0 ``` All domains, tokens, UUIDs and other sensitive identifiers have been redacted. ### How to reproduce the problem The issue could not be reproduced deterministically, but the following sequence reproduces the conditions under which the problem occurred: 1. Set up a Sanaei v3.9.0 Master and Node, both running Xray 26.9.30, with PostgreSQL on the Master. 2. Create a Node inbound on the Master and synchronize/deploy it to the Node. 3. Attach multiple existing clients, which already have traffic history, to this Node inbound. 4. Allow the clients to generate traffic and confirm that: - The Node/Xray reports non-zero traffic for the clients. - The Master contains corresponding client traffic history. 5. Allow the normal Node Traffic Sync / reconciliation process to run. 6. During the affected incident, the original Master inbound (ID 20) disappeared from the Master database, even though the corresponding inbound on the Node was not recreated or removed. 7. After a subsequent synchronization, the same Node inbound appeared again on the Master with a new inbound ID (ID 24). 8. After this lifecycle, multiple affected clients had their Master-side `client_traffics` reset to `0 / 0`, while the Node still reported their actual cumulative traffic. 9. Repeating the bulk client-to-inbound attachment operation alone did not reproduce the issue consistently. This suggests that the problem is timing-dependent and related to Node Traffic Sync / reconciliation or a transient/incomplete Node snapshot. The issue appears to require a specific synchronization/reconciliation timing condition rather than being triggered by the client attachment operation alone. ### Expected behavior _No response_ ### Actual behavior _No response_ ### Relevant logs ```shell ``` ### Screenshots _No response_ ### 3x-ui version 3.9.0 ### Xray-core version 26.9.30 ### How did you install 3x-ui? install.sh script ### Operating system ubuntu 24.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? None ### 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:04 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

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

The 0 / 0 part is a real bug, and it is still in the code on the default branch. When SetRemoteTraffic replaces a node inbound with a new central row, it deletes the old inbound's client_traffics rows. On the next sync it recreates them at zero, and it moves the node baseline up to the node's current counters. The history is then gone for good, and only traffic used after that point gets counted. Your numbers fit this exactly. What I could not pin down is why the snapshot's tag did not match inbound 20. That is what the log line requested at the end would show.

@MHSanaei: a confirmed bug that resets client quota accounting on node inbounds.

What the code does

Everything below is in internal/web/service/inbound_node.go, SetRemoteTraffic.

  1. existingEmails (the set of emails that already have a client_traffics row) is computed once, before the transaction opens (L640-655).
  2. If a snapshot inbound's tag does not resolve through tagToCentral (the stored tag or its n2- prefix-flipped form, L542-553), the code looks for an alias. It only accepts one that matches exactly on origin GUID, port, protocol and listen (L701-704):
    if candidate.OriginNodeGuid == origin &&
    	candidate.Port == snapIb.Port &&
    	candidate.Protocol == snapIb.Protocol &&
    
    If nothing matches, it creates a new central inbound (L758-786). The new inbound's Up/Down come from the snapshot (L778-779). That would explain why your inbound-level ~499 GB survived on ID 24.
  3. In the same tick, the sweep deletes the old inbound because its tag is not in snapTags. The guard at L874 only protects a completely empty snapshot. A non-empty snapshot that lacks this one tag goes through. The sweep deletes the per-email rows unless the email is also attached to another inbound (L920-935), which matches your note that some clients kept their history:
    logger.Warningf("setRemoteTraffic: node %d no longer reports inbound %q (id %d, port %d) — removing it centrally", ...)
    
  4. Later in the same tick, the stale existingEmails from step 1 still lists those emails. No row gets created, and the UPDATE ... WHERE email = ? statements hit nothing.
  5. On the next tick the rows are missing, and inbound 24 no longer counts as a new inbound. The code then takes the zero-seed branch (L998-1001) and resets the baseline to the node's totals (L1025):
    var seedUp, seedDown int64
    if isNewInbound && !isClientEmailTombstoned(cs.Email) {
    	seedUp, seedDown = canon.Up, canon.Down
    }
    
    The client row stays at 0/0 while the node keeps reporting its full totals. This matches Baba, Hexa_418825 and the others.

Your two-tick theory (missing from one snapshot, back in the next) would not give 0/0. In that case the next tick creates the new inbound as new, and the rows get seeded with the node's counters (L999-1000). The 0/0 result points to the single-tick replace above: the snapshot did report the inbound, under a tag that matched neither inbound 20's tag nor an alias.

A likely reason the alias check fails: a node inbound created on the master starts with an empty OriginNodeGuid. inbound.go:218 only fills it in for local inbounds (ib.NodeID == nil). The value is otherwise only backfilled at L843-845, after a tag match succeeds. So an inbound that loses its tag match has no GUID-based fallback. This is an inference; I have not confirmed it for your data.

On your questions: (3) yes, the sweep (L865-946) deletes on a single non-empty snapshot. (4) yes, as shown above. (6) the alias path (L695-718, added in bb29b6af) is meant to do exactly this, but its strict equality on OriginNodeGuid/listen can miss.

The connection-refused log line is unrelated to the deletion, as you suspected.

Verdict:        Confirmed bug
Severity:       High
Confidence:     Medium
Root cause:     internal/web/service/inbound_node.go SetRemoteTraffic: a snapshot tag that
                misses tagToCentral and the alias check (L695-718) creates a new inbound while
                the sweep (L865-946) deletes the old one and its client_traffics in the same
                tick. existingEmails (L640-655) is computed before that delete, so the rows
                come back next tick seeded at 0 (L998-1001) with the baseline moved to the
                node totals (L1025).
Already fixed:  Still present on the default branch (66ef5bbc). The two node fixes since
                v3.9.0, 2c5fc8e7 (#6734, empty client lists) and dd956947 (detached clients),
                do not touch this path.
Duplicate of:   None
Evidence:       inbound_node.go L640-655, L701-704, L758-786, L874-891, L920-935, L998-1001, L1025;
                inbound.go:218-219 (OriginNodeGuid only set for NodeID == nil);
                runtime/remote.go:854-858 (n<id>- prefix stripped before pushing to the node)
Not determined: What tag inbound 20 had compared to what the node reported.

Suggested fix: When the sweep removes an inbound whose emails the same snapshot still reports under a newly adopted inbound, move the client_traffics rows and baselines over instead of deleting them. Otherwise, refresh existingEmails after the sweep so the rows are seeded from the node's counters. Separately, the alias check could fall back to node + port + protocol + listen when the central OriginNodeGuid is empty.

One thing that would settle the open point

Please run this on the master and paste the matching lines as text. They contain inbound 20's old tag:

journalctl -u x-ui --no-pager | grep "no longer reports inbound"

Please also paste the tag of the proxy / 2053 inbound as the node's own panel shows it (Inbounds -> the inbound's JSON).

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

<!-- gh-comment-id:6008109613 --> @github-actions[bot] commented on GitHub (Oct 6, 2026): The `0 / 0` part is a real bug, and it is still in the code on the default branch. When `SetRemoteTraffic` replaces a node inbound with a new central row, it deletes the old inbound's `client_traffics` rows. On the next sync it recreates them **at zero**, and it moves the node baseline up to the node's current counters. The history is then gone for good, and only traffic used after that point gets counted. Your numbers fit this exactly. What I could not pin down is *why* the snapshot's tag did not match inbound `20`. That is what the log line requested at the end would show. @MHSanaei: a confirmed bug that resets client quota accounting on node inbounds. ### What the code does Everything below is in `internal/web/service/inbound_node.go`, `SetRemoteTraffic`. 1. `existingEmails` (the set of emails that already have a `client_traffics` row) is computed once, **before** the transaction opens (L640-655). 2. If a snapshot inbound's tag does not resolve through `tagToCentral` (the stored tag or its `n2-` prefix-flipped form, L542-553), the code looks for an alias. It only accepts one that matches exactly on origin GUID, port, protocol and listen (L701-704): ```go if candidate.OriginNodeGuid == origin && candidate.Port == snapIb.Port && candidate.Protocol == snapIb.Protocol && ``` If nothing matches, it creates a new central inbound (L758-786). The new inbound's `Up`/`Down` come from the snapshot (L778-779). That would explain why your inbound-level ~499 GB survived on ID `24`. 3. In the same tick, the sweep deletes the old inbound because its tag is not in `snapTags`. The guard at L874 only protects a completely empty snapshot. A non-empty snapshot that lacks this one tag goes through. The sweep deletes the per-email rows unless the email is also attached to another inbound (L920-935), which matches your note that some clients kept their history: ```go logger.Warningf("setRemoteTraffic: node %d no longer reports inbound %q (id %d, port %d) — removing it centrally", ...) ``` 4. Later in the same tick, the stale `existingEmails` from step 1 still lists those emails. No row gets created, and the `UPDATE ... WHERE email = ?` statements hit nothing. 5. On the **next** tick the rows are missing, and inbound `24` no longer counts as a new inbound. The code then takes the zero-seed branch (L998-1001) and resets the baseline to the node's totals (L1025): ```go var seedUp, seedDown int64 if isNewInbound && !isClientEmailTombstoned(cs.Email) { seedUp, seedDown = canon.Up, canon.Down } ``` The client row stays at `0/0` while the node keeps reporting its full totals. This matches `Baba`, `Hexa_418825` and the others. Your two-tick theory (missing from one snapshot, back in the next) would **not** give `0/0`. In that case the next tick creates the new inbound as new, and the rows get seeded with the node's counters (L999-1000). The `0/0` result points to the single-tick replace above: the snapshot did report the inbound, under a tag that matched neither inbound `20`'s tag nor an alias. A likely reason the alias check fails: a node inbound created on the master starts with an empty `OriginNodeGuid`. `inbound.go:218` only fills it in for local inbounds (`ib.NodeID == nil`). The value is otherwise only backfilled at L843-845, after a tag match succeeds. So an inbound that loses its tag match has no GUID-based fallback. This is an inference; I have not confirmed it for your data. On your questions: (3) yes, the sweep (L865-946) deletes on a single non-empty snapshot. (4) yes, as shown above. (6) the alias path (L695-718, added in `bb29b6af`) is meant to do exactly this, but its strict equality on `OriginNodeGuid`/listen can miss. The connection-refused log line is unrelated to the deletion, as you suspected. ``` Verdict: Confirmed bug Severity: High Confidence: Medium Root cause: internal/web/service/inbound_node.go SetRemoteTraffic: a snapshot tag that misses tagToCentral and the alias check (L695-718) creates a new inbound while the sweep (L865-946) deletes the old one and its client_traffics in the same tick. existingEmails (L640-655) is computed before that delete, so the rows come back next tick seeded at 0 (L998-1001) with the baseline moved to the node totals (L1025). Already fixed: Still present on the default branch (66ef5bbc). The two node fixes since v3.9.0, 2c5fc8e7 (#6734, empty client lists) and dd956947 (detached clients), do not touch this path. Duplicate of: None Evidence: inbound_node.go L640-655, L701-704, L758-786, L874-891, L920-935, L998-1001, L1025; inbound.go:218-219 (OriginNodeGuid only set for NodeID == nil); runtime/remote.go:854-858 (n<id>- prefix stripped before pushing to the node) Not determined: What tag inbound 20 had compared to what the node reported. ``` Suggested fix: When the sweep removes an inbound whose emails the same snapshot still reports under a newly adopted inbound, move the `client_traffics` rows and baselines over instead of deleting them. Otherwise, refresh `existingEmails` after the sweep so the rows are seeded from the node's counters. Separately, the alias check could fall back to node + port + protocol + listen when the central `OriginNodeGuid` is empty. ### One thing that would settle the open point Please run this on the **master** and paste the matching lines as text. They contain inbound `20`'s old tag: ```bash journalctl -u x-ui --no-pager | grep "no longer reports inbound" ``` Please also paste the `tag` of the `proxy` / `2053` inbound **as the node's own panel shows it** (Inbounds -> the inbound's JSON). *This reply was generated automatically; a maintainer may follow up.* <!-- claude-issue:analyst -->
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#4498
No description provided.