[GH-ISSUE #5845] [Bug]: Deleting client on master does not delete it from online remote node #4057

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

Originally created by @menzhu on GitHub (Jul 7, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5845

Describe the bug

Deleting a client from the master panel does not reliably delete the same client from an online remote node.

In my test, the remote node was online. I deleted the client from the master panel, but the client still existed on the remote node. I tried the same delete operation twice and the remote node still kept the client.

This looks similar to previously closed reports, but it is still reproducible on a newer build and with the node online.

How to reproduce the problem

  1. Set up a master 3x-ui panel with a remote node.
  2. Make sure the remote node is enabled and shown as online on the master.
  3. Add a client from the master panel to an inbound hosted on the remote node.
  4. Confirm the client exists on the remote node.
  5. Delete the client from the master panel, from the Clients page.
  6. Refresh/check the remote node.
  7. Repeat the delete operation from the master if the client still appears.

The client is removed from the master panel, but remains on the remote node.

Expected behavior

When deleting a client from the master panel, the master should delete the client from all attached remote node inbounds and from the remote node's client records.

If the remote deletion fails, the master should not silently report success. It should either:

  • return an error to the UI/API caller, or
  • keep a durable pending delete task and retry when the node is reachable, or
  • force a reconcile that removes the stale client from the node.

Actual behavior

The master reports a successful delete locally, but the remote node still contains the client.

The node was online when the delete was performed.

Source review

The delete path appears to be:

  • ClientController.delete() handles POST /panel/api/clients/del/:email
  • ClientService.DeleteByEmail() resolves the client
  • ClientService.Delete() iterates attached inbounds
  • ClientService.DelInboundClientByEmail(..., fullDelete=true) removes the client locally and then tries to propagate the delete to the node
  • for node inbounds, it calls Remote.DeleteClient()
  • Remote.DeleteClient() sends POST /panel/api/clients/del/:email to the remote node

Relevant source areas:

  • internal/web/controller/client.go: ClientController.delete
  • internal/web/service/client_crud.go: DeleteByEmail() and Delete()
  • internal/web/service/client_inbound_apply.go: DelInboundClientByEmail()
  • internal/web/runtime/remote.go: Remote.DeleteClient()

The risky part is in DelInboundClientByEmail(): after the master DB is already updated, the remote delete error is only logged:

if err1 != nil {
    logger.Warning("Error in deleting client on", rt.Name(), ":", err1)
} else {
    advancePushedInbound(rt, prevSettings, oldInbound)
}

So the UI/API caller can see success even when the remote node delete failed. After that, the master may no longer have enough local state to retry the exact full client delete.

Also, for some paths such as detach or inbound update, the node may only receive an inbound update/detach rather than a full clients/del/:email, which can leave the remote node's client record visible.

Related closed reports:

  • #4971: "The user is not being deleted on the nodes"
  • #5352: "Cannot delete client on remote node"
  • #5383: "When a user is deleted from the main panel via the API, it is not deleted from the nodes"

This report adds that the issue is still reproducible with the remote node online, and includes a source-level explanation of why a remote delete failure can be hidden from the caller.

Relevant logs

Please check the master logs for a warning like:

Error in deleting client on node:

In the current implementation, such a warning may be emitted while the API response still reports success to the frontend.

3x-ui version

3.4.2

Xray-core version

v26.6.27

How did you install 3x-ui?

docker compose

Operating system

ubuntu2404

Which parts of the panel are affected?

Clients, Multi-node (sub-nodes), Backend (API endpoints)

Browser (only if it is a UI bug)

N/A

Is the panel behind a reverse proxy or CDN?

Please fill in.

Before submitting

  • I searched existing issues and found related closed reports, but the issue is still reproducible.
  • 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.
Originally created by @menzhu on GitHub (Jul 7, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5845 ### Describe the bug Deleting a client from the master panel does not reliably delete the same client from an online remote node. In my test, the remote node was online. I deleted the client from the master panel, but the client still existed on the remote node. I tried the same delete operation twice and the remote node still kept the client. This looks similar to previously closed reports, but it is still reproducible on a newer build and with the node online. ### How to reproduce the problem 1. Set up a master 3x-ui panel with a remote node. 2. Make sure the remote node is enabled and shown as online on the master. 3. Add a client from the master panel to an inbound hosted on the remote node. 4. Confirm the client exists on the remote node. 5. Delete the client from the master panel, from the Clients page. 6. Refresh/check the remote node. 7. Repeat the delete operation from the master if the client still appears. The client is removed from the master panel, but remains on the remote node. ### Expected behavior When deleting a client from the master panel, the master should delete the client from all attached remote node inbounds and from the remote node's client records. If the remote deletion fails, the master should not silently report success. It should either: - return an error to the UI/API caller, or - keep a durable pending delete task and retry when the node is reachable, or - force a reconcile that removes the stale client from the node. ### Actual behavior The master reports a successful delete locally, but the remote node still contains the client. The node was online when the delete was performed. ### Source review The delete path appears to be: - `ClientController.delete()` handles `POST /panel/api/clients/del/:email` - `ClientService.DeleteByEmail()` resolves the client - `ClientService.Delete()` iterates attached inbounds - `ClientService.DelInboundClientByEmail(..., fullDelete=true)` removes the client locally and then tries to propagate the delete to the node - for node inbounds, it calls `Remote.DeleteClient()` - `Remote.DeleteClient()` sends `POST /panel/api/clients/del/:email` to the remote node Relevant source areas: - `internal/web/controller/client.go`: `ClientController.delete` - `internal/web/service/client_crud.go`: `DeleteByEmail()` and `Delete()` - `internal/web/service/client_inbound_apply.go`: `DelInboundClientByEmail()` - `internal/web/runtime/remote.go`: `Remote.DeleteClient()` The risky part is in `DelInboundClientByEmail()`: after the master DB is already updated, the remote delete error is only logged: ```go if err1 != nil { logger.Warning("Error in deleting client on", rt.Name(), ":", err1) } else { advancePushedInbound(rt, prevSettings, oldInbound) } ``` So the UI/API caller can see success even when the remote node delete failed. After that, the master may no longer have enough local state to retry the exact full client delete. Also, for some paths such as detach or inbound update, the node may only receive an inbound update/detach rather than a full `clients/del/:email`, which can leave the remote node's client record visible. ### Related issues Related closed reports: - #4971: "The user is not being deleted on the nodes" - #5352: "Cannot delete client on remote node" - #5383: "When a user is deleted from the main panel via the API, it is not deleted from the nodes" This report adds that the issue is still reproducible with the remote node online, and includes a source-level explanation of why a remote delete failure can be hidden from the caller. ### Relevant logs Please check the master logs for a warning like: ```text Error in deleting client on node: ``` In the current implementation, such a warning may be emitted while the API response still reports success to the frontend. ### 3x-ui version 3.4.2 ### Xray-core version v26.6.27 ### How did you install 3x-ui? docker compose ### Operating system ubuntu2404 ### Which parts of the panel are affected? Clients, Multi-node (sub-nodes), Backend (API endpoints) ### Browser (only if it is a UI bug) N/A ### Is the panel behind a reverse proxy or CDN? Please fill in. ### Before submitting - [x] I searched existing issues and found related closed reports, but the issue is still reproducible. - [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.
bsakaguchi 2026-10-31 20:36:50 +07:00
Author
Owner

@github-actions[bot] commented on GitHub (Jul 7, 2026):

Confirmed against the current source, with one important caveat on versioning first.

Version check: the identifiers quoted in the report (DelInboundClientByEmail(..., fullDelete=true), Remote.DeleteClient()) do not exist in the released v3.4.2 tag (2026-06-29), nor even in the dev-latest pre-release build (2026-06-24). They were introduced by commit b1fa76f ("fix(node): fully delete clients on nodes instead of only detaching them"), merged 2026-07-05, which closed #5797 — and that commit is only on the unreleased main branch (81 commits ahead of v3.4.2). Please confirm the exact commit/build you're actually running; "3.4.2" as entered doesn't match the code you quoted.

What that commit changed: previously a client delete on the master only ever sent the inbound-scoped detach RPC to the node, so the node kept an orphaned client record (#5797, #5352, #5383). The fix splits "detach" from "full delete": Delete/DeleteByEmail/BulkDelete now call the new Remote.DeleteClient (internal/web/runtime/remote.go:556-570), which POSTs to the node's real full-delete endpoint, panel/api/clients/del/:email (ClientController.delete → ClientService.Delete, which removes ClientInbound, ClientExternalLink, traffic rows, and the ClientRecord itself — internal/web/service/client_crud.go:452-523). When that call succeeds, the node is fully cleaned up.

Why it can still fail with the node online — two gaps remain in that same code path, and they match your report closely:

  1. A failed rt.DeleteClient call is only logged, never returned as an error:

    // internal/web/service/client_inbound_apply.go:1027-1039
    if fullDelete {
        err1 = rt.DeleteClient(context.Background(), email)
    } else {
        err1 = rt.DeleteUser(context.Background(), oldInbound, email)
    }
    if err1 != nil {
        logger.Warning("Error in deleting client on", rt.Name(), ":", err1)
    } else {
        advancePushedInbound(rt, prevSettings, oldInbound)
    }
    

    Delete/DeleteByEmail/ClientController.delete return success to the UI/API caller regardless of whether the node actually received the delete.

  2. The node is unconditionally marked dirty in the same transaction (NodeService.MarkNodeDirtyTx, called at client_inbound_apply.go:986-988), and the next NodeTrafficSyncJob tick reconciles a dirty node (internal/web/job/node_traffic_sync_job.go:366-380). But ReconcileNode (internal/web/service/inbound_node.go:89-157) only re-pushes the inbound's settings via panel/api/inbounds/update/:id; on the node side that lands in InboundService.UpdateInbound, which ends by calling ClientService.SyncInbound (internal/web/service/client_link.go:12-164, invoked from inbound.go:1312). SyncInbound only rebuilds the client_inbounds join rows for that inbound — it never deletes a ClientRecord. So the automatic dirty-reconcile fallback can at best re-detach the client on the node; it cannot finish a full delete. The fix commit's own message acknowledges this gap: "leftover node records can be cleaned with the node's delete-orphans action."

  3. Retrying the delete from the master doesn't help either: ClientService.Delete (client_crud.go:452-523) removes the master's own ClientRecord, ClientInbound rows, and the inbound-settings entry regardless of whether the node RPC succeeded. Once that's gone locally, a second DeleteByEmail call finds no local record and no local inbound-settings entry for that email (findInboundIdsByClientEmail, client_lookup.go:197) and returns client "<email>" not found in any inbound or client record — there is nothing left on the master to re-send, so repeating the delete cannot re-trigger propagation to the node.

Workaround for the leftover record today: on the affected node's own panel, use "Delete unattached clients" (POST panel/api/clients/delOrphans → ClientService.DeleteOrphans, internal/web/service/client_portable.go:168) to remove the orphaned client record directly.

What's still missing: surfacing the rt.DeleteClient failure to the caller (or a durable retry of the exact delete RPC, rather than a generic settings reconcile) so the API/UI stop reporting success on a delete the node never actually received.

To pin this down further, could you share:

  1. The exact build/commit you're running (x-ui menu → check version, or git rev-parse HEAD if built from source) — this is not stock v3.4.2 or dev-latest.
  2. Master log lines around the delete matching Error in deleting client on (confirms whether the RPC failed, and why).
  3. Whether "Delete unattached clients" on the node panel actually removes the leftover client record.

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

<!-- gh-comment-id:4899768057 --> @github-actions[bot] commented on GitHub (Jul 7, 2026): Confirmed against the current source, with one important caveat on versioning first. **Version check**: the identifiers quoted in the report (`DelInboundClientByEmail(..., fullDelete=true)`, `Remote.DeleteClient()`) do not exist in the released `v3.4.2` tag (2026-06-29), nor even in the `dev-latest` pre-release build (2026-06-24). They were introduced by commit `b1fa76f` ("fix(node): fully delete clients on nodes instead of only detaching them"), merged 2026-07-05, which closed #5797 — and that commit is only on the unreleased `main` branch (81 commits ahead of `v3.4.2`). Please confirm the exact commit/build you're actually running; "3.4.2" as entered doesn't match the code you quoted. **What that commit changed**: previously a client delete on the master only ever sent the inbound-scoped `detach` RPC to the node, so the node kept an orphaned client record (#5797, #5352, #5383). The fix splits "detach" from "full delete": `Delete`/`DeleteByEmail`/`BulkDelete` now call the new `Remote.DeleteClient` (`internal/web/runtime/remote.go:556-570`), which POSTs to the node's real full-delete endpoint, `panel/api/clients/del/:email` (`ClientController.delete` → `ClientService.Delete`, which removes `ClientInbound`, `ClientExternalLink`, traffic rows, and the `ClientRecord` itself — `internal/web/service/client_crud.go:452-523`). When that call succeeds, the node is fully cleaned up. **Why it can still fail with the node online** — two gaps remain in that same code path, and they match your report closely: 1. A failed `rt.DeleteClient` call is only logged, never returned as an error: ```go // internal/web/service/client_inbound_apply.go:1027-1039 if fullDelete { err1 = rt.DeleteClient(context.Background(), email) } else { err1 = rt.DeleteUser(context.Background(), oldInbound, email) } if err1 != nil { logger.Warning("Error in deleting client on", rt.Name(), ":", err1) } else { advancePushedInbound(rt, prevSettings, oldInbound) } ``` `Delete`/`DeleteByEmail`/`ClientController.delete` return success to the UI/API caller regardless of whether the node actually received the delete. 2. The node is unconditionally marked dirty in the same transaction (`NodeService.MarkNodeDirtyTx`, called at `client_inbound_apply.go:986-988`), and the next `NodeTrafficSyncJob` tick reconciles a dirty node (`internal/web/job/node_traffic_sync_job.go:366-380`). But `ReconcileNode` (`internal/web/service/inbound_node.go:89-157`) only re-pushes the inbound's settings via `panel/api/inbounds/update/:id`; on the node side that lands in `InboundService.UpdateInbound`, which ends by calling `ClientService.SyncInbound` (`internal/web/service/client_link.go:12-164`, invoked from `inbound.go:1312`). `SyncInbound` only rebuilds the `client_inbounds` join rows for that inbound — it never deletes a `ClientRecord`. So the automatic dirty-reconcile fallback can at best re-detach the client on the node; it cannot finish a full delete. The fix commit's own message acknowledges this gap: "leftover node records can be cleaned with the node's delete-orphans action." 3. Retrying the delete from the master doesn't help either: `ClientService.Delete` (`client_crud.go:452-523`) removes the master's own `ClientRecord`, `ClientInbound` rows, and the inbound-settings entry regardless of whether the node RPC succeeded. Once that's gone locally, a second `DeleteByEmail` call finds no local record and no local inbound-settings entry for that email (`findInboundIdsByClientEmail`, `client_lookup.go:197`) and returns `client "<email>" not found in any inbound or client record` — there is nothing left on the master to re-send, so repeating the delete cannot re-trigger propagation to the node. **Workaround for the leftover record today**: on the affected node's own panel, use "Delete unattached clients" (`POST panel/api/clients/delOrphans` → `ClientService.DeleteOrphans`, `internal/web/service/client_portable.go:168`) to remove the orphaned client record directly. **What's still missing**: surfacing the `rt.DeleteClient` failure to the caller (or a durable retry of the exact delete RPC, rather than a generic settings reconcile) so the API/UI stop reporting success on a delete the node never actually received. To pin this down further, could you share: 1. The exact build/commit you're running (`x-ui` menu → check version, or `git rev-parse HEAD` if built from source) — this is not stock `v3.4.2` or `dev-latest`. 2. Master log lines around the delete matching `Error in deleting client on` (confirms whether the RPC failed, and why). 3. Whether "Delete unattached clients" on the node panel actually removes the leftover client record. *This reply was generated automatically; a maintainer may follow up.*
Author
Owner

@parsa-fathi commented on GitHub (Jul 7, 2026):

I've experienced exactly the same issue.

<!-- gh-comment-id:4903829008 --> @parsa-fathi commented on GitHub (Jul 7, 2026): I've experienced exactly the same issue.
Author
Owner

@sajadfaith commented on GitHub (Jul 7, 2026):

ive tested with 1 master and 7 node for every client i should delete 7 times from master and each time client diattach from 1 node even the user is not online and some times i should delete more than 7 times because the client appears with the same nodes also after full diattach i should delete from nodes too it really takes times to delete 1 single client
also after delete when it appears the terafic will be reset
master after first time delete appears again:
Image
node that ive connected to:
Image
other nodes:
Image

Version: 3.4.0 and above

<!-- gh-comment-id:4907929616 --> @sajadfaith commented on GitHub (Jul 7, 2026): ive tested with 1 master and 7 node for every client i should delete 7 times from master and each time client diattach from 1 node even the user is not online and some times i should delete more than 7 times because the client appears with the same nodes also after full diattach i should delete from nodes too it really takes times to delete 1 single client also after delete when it appears the terafic will be reset master after first time delete appears again: <img width="836" height="145" alt="Image" src="https://github.com/user-attachments/assets/a36f1bca-7369-423b-9a4e-517b9a6db21c" /> node that ive connected to: <img width="1000" height="141" alt="Image" src="https://github.com/user-attachments/assets/801143c0-f95e-42ce-aca2-d4109c22918f" /> other nodes: <img width="1045" height="166" alt="Image" src="https://github.com/user-attachments/assets/bffe7d8f-5285-4a17-8c52-8921ffd606fc" /> Version: 3.4.0 and above
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#4057
No description provided.