mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #5845] [Bug]: Deleting client on master does not delete it from online remote node #4057
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#4057
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @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
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:
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()handlesPOST /panel/api/clients/del/:emailClientService.DeleteByEmail()resolves the clientClientService.Delete()iterates attached inboundsClientService.DelInboundClientByEmail(..., fullDelete=true)removes the client locally and then tries to propagate the delete to the nodeRemote.DeleteClient()Remote.DeleteClient()sendsPOST /panel/api/clients/del/:emailto the remote nodeRelevant source areas:
internal/web/controller/client.go:ClientController.deleteinternal/web/service/client_crud.go:DeleteByEmail()andDelete()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: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:
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:
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
@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 releasedv3.4.2tag (2026-06-29), nor even in thedev-latestpre-release build (2026-06-24). They were introduced by commitb1fa76f("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 unreleasedmainbranch (81 commits ahead ofv3.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
detachRPC to the node, so the node kept an orphaned client record (#5797, #5352, #5383). The fix splits "detach" from "full delete":Delete/DeleteByEmail/BulkDeletenow call the newRemote.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 removesClientInbound,ClientExternalLink, traffic rows, and theClientRecorditself —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:
A failed
rt.DeleteClientcall is only logged, never returned as an error:Delete/DeleteByEmail/ClientController.deletereturn success to the UI/API caller regardless of whether the node actually received the delete.The node is unconditionally marked dirty in the same transaction (
NodeService.MarkNodeDirtyTx, called atclient_inbound_apply.go:986-988), and the nextNodeTrafficSyncJobtick reconciles a dirty node (internal/web/job/node_traffic_sync_job.go:366-380). ButReconcileNode(internal/web/service/inbound_node.go:89-157) only re-pushes the inbound's settings viapanel/api/inbounds/update/:id; on the node side that lands inInboundService.UpdateInbound, which ends by callingClientService.SyncInbound(internal/web/service/client_link.go:12-164, invoked frominbound.go:1312).SyncInboundonly rebuilds theclient_inboundsjoin rows for that inbound — it never deletes aClientRecord. 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."Retrying the delete from the master doesn't help either:
ClientService.Delete(client_crud.go:452-523) removes the master's ownClientRecord,ClientInboundrows, and the inbound-settings entry regardless of whether the node RPC succeeded. Once that's gone locally, a secondDeleteByEmailcall finds no local record and no local inbound-settings entry for that email (findInboundIdsByClientEmail,client_lookup.go:197) and returnsclient "<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.DeleteClientfailure 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:
x-uimenu → check version, orgit rev-parse HEADif built from source) — this is not stockv3.4.2ordev-latest.Error in deleting client on(confirms whether the RPC failed, and why).This reply was generated automatically; a maintainer may follow up.
@parsa-fathi commented on GitHub (Jul 7, 2026):
I've experienced exactly the same issue.
@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:
node that ive connected to:
other nodes:
Version: 3.4.0 and above