mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #6432] [Bug]: Attaching multiple clients to a VLESS inbound leaves flow empty (Disable XTLS flow off) #4354
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#4354
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 @AlexeyLCP on GitHub (Sep 7, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6432
Describe the bug
With Disable XTLS flow unchecked on a flow-capable VLESS inbound (TCP + Reality/TLS), attaching clients should write
flow: \"xtls-rprx-vision\"into each client in the inbound settings JSON and into share/subscription links (flow=xtls-rprx-vision).What happens instead:
flow: \"\".flow=xtls-rprx-vision.On some servers even attaching VLESS to a single existing client (created earlier without a VLESS inbound) never writes the flow line.
Disable XTLS flowis supposed to be the opt-out. When it is off, emptyflow: \"\"should not be the default for clients on that inbound.Related but not the same:
Likely write-path gap (from current
main):ClientService.AttachcopiesEffectiveFlowonto the client beforeclientWithInboundFlow.ClientService.BulkAttachusesrec.ToClient()as-is and never callsEffectiveFlow.clientWithInboundFlowonly strips flow whendisableFlowis set or the inbound is not flow-capable. It never fillsxtls-rprx-visionwhen the stored client flow is already empty (typical for clients that were created on a non-VLESS inbound first).How to reproduce the problem
settings.clients) and copy each client share link.Compare with attaching only one of those clients the same way.
Expected behavior
With Disable XTLS flow off, every client on that inbound should have:
and the vless share/subscription link should contain
flow=xtls-rprx-vision.With Disable XTLS flow on,
flowshould stay empty.Actual behavior
After attaching two clients, inbound JSON has
flow: \"\"on both. Share links have noflow=parameter.Attaching a single client to the same inbound often works.
Relevant logs
Screenshots
Inbound JSON after attaching two clients (Disable XTLS flow off):
Same inbound with one client attached (working case):
3x-ui version
3.7.0
Xray-core version
26.7.28
How did you install 3x-ui?
install.sh script
Operating system
Ubuntu 24.04 / Debian
Which parts of the panel are affected?
Browser (only if it is a UI bug)
No response
Is the panel behind a reverse proxy or CDN?
No — direct access
Before submitting
@github-actions[bot] commented on GitHub (Sep 7, 2026):
Your report splits into two halves: the behaviour you expected (empty flow should default to
xtls-rprx-visionwhen Disable XTLS flow is off) is intended and will not change, but your read of the write path found a real defect —BulkAttachstill seeds the client from the canonicalclients.flowcolumn, which is exactly the bug that was fixed for the single-clientAttachpath in #4834 and never applied to the bulk path. It is still present on the default branch.1. The panel never auto-fills Vision — that part is by design
A client's flow is a per-client choice, not an inbound default. A new client's form starts empty:
and the restore path states the rule explicitly:
It is also pinned by a test —
TestEffectiveFlow_ClearedFlowStaysCleared(internal/web/service/client_flow_isolation_test.go:145), whose comment reads "User chose no flow: every inbound carries"".Disable XTLS flow is the opt-out for propagating an existing Vision flow, not a switch that turns Vision on. Its own help string says so:
(
internal/web/translation/en-US.json:668)So your reproduction steps as written — clients that were only ever on a non-flow protocol, i.e. clients with no Vision flow anywhere — produce
"flow": ""correctly, on both the single and the bulk path.2. The real bug: bulk attach drops a Vision flow the client does have
Attachderives the flow from the per-inboundflow_override:BulkAttachdoes not — it takes the record as-is:and
ToClient()copies the canonical column (internal/database/model/model.go:1181,Flow: r.Flow). That column is unreliable, which is whyEffectiveFlowexists (internal/web/service/client_lookup.go:27-33, issue #4792): every sync writes it unconditionally —— so as soon as a non-flow inbound (WS/gRPC/Hysteria/Trojan/SS…) syncs last,
clients.flowbecomes""while the Reality inbound'sflow_overridestill holds Vision. Bulk-attaching that client then writes"flow": "", andclientWithInboundFlowcannot save it because it only ever strips (internal/web/service/client_crud.go:434-437) — your third bullet is correct, though that stripping-only behaviour is itself intended.The trigger is the code path, not the number of clients. The inbound page's attach existing clients modal always posts to the bulk endpoint, one client or ten:
Adding an inbound from the Clients page client editor instead goes to
/panel/api/clients/{email}/attach(frontend/src/pages/clients/ClientsPage.tsx:969→internal/web/controller/client.go:271→Attach), which usesEffectiveFlowand keeps Vision. That asymmetry is what you saw as "sometimes it works".Workarounds today
UpdateInboundrunsrestoreVisionFlowForEligibleInbound(internal/web/service/inbound.go:1603-1606) and re-adds Vision to clients whose intended flow is Vision.xtls-rprx-vision(/panel/api/clients/bulkAdjust; honoured on flow-eligible inbounds,internal/web/service/client_bulk.go:654-688). This also works for clients that never had a flow.Which case are you hitting?
Open the client in the Clients-page editor before attaching. The flow shown there is
EffectiveFlow-derived (internal/web/controller/client.go:121-125). If it showsxtls-rprx-visionthere but the inbound JSON has""after bulk attach, that is the confirmed bug; if it is empty there too, the client has no Vision anywhere and workaround 2 is the answer.I also retitled the issue for the maintainer — from "[Bug]: Attaching multiple clients to a VLESS inbound leaves flow empty (Disable XTLS flow off)" — because the client count is not the trigger.
Verdict: Confirmed bug
Severity: Medium
Confidence: High
Root cause:
ClientService.BulkAttach,internal/web/service/client_bulk.go:102—client := *rec.ToClient()seeds the wire client from the denormalizedclients.flowcolumn instead ofEffectiveFlow. Triggered whenever a bulk-attached client's canonical column has been zeroed by a non-flow inbound's sync (internal/web/service/client_link.go:38) while a sibling inbound'sflow_overridestill holds Vision.BulkAttachlanded in1a096d72(2026-05-28, feat(inbounds): bulk-attach & assign-group client actions);b08fc0c9(2026-06-02, fix(clients): keep reverse tag clearable and preserve flow on attach, issue #4834) fixed the identical read inAttachand did not touch the bulk path.Already fixed: Still present on the default branch (
a5e68f41); v3.7.0 is the latest release, so the reporter is at the tip.Duplicate of: None. Related: #4834 (same defect, fixed for
Attachonly), #5689 / PR #5698 (theDisableFlowopt-out this report contrasts with).Evidence:
internal/web/service/client_bulk.go:102,108;internal/web/service/client_crud.go:965-970(Attach usesEffectiveFlow) and:434-437(clientWithInboundFlowstrips only);internal/database/model/model.go:1181;internal/web/service/client_link.go:38;internal/web/service/client_lookup.go:27-33; intended-behaviour side:internal/web/service/inbound_flow_restore.go:26-27,TestEffectiveFlow_ClearedFlowStaysCleared(client_flow_isolation_test.go:145-189),TestAttach_PreservesVisionFlowWhenCanonicalColumnZeroed(client_flow_isolation_test.go:191-265),frontend/src/pages/clients/ClientFormModal.tsx:146. No test covers flow on the bulk path —internal/web/service/bulk_clients_test.gocontains no flow assertion at all.Not determined: Whether the reporter's own servers hit the confirmed defect or the by-design empty-flow case; their steps describe clients with no Vision flow anywhere, which is the intended case. The client-editor flow value before attaching (see above) settles it.
Suggested fix: In
BulkAttach, resolve the flow the same wayAttachdoes —EffectiveFlow/EffectiveFlowsByEmailsfor the record set — beforeclientWithInboundFlowgates it per inbound. A regression test belongs next toTestAttach_PreservesVisionFlowWhenCanonicalColumnZeroed, drivingBulkAttachwith the canonicalclients.flowzeroed.This reply was generated automatically; a maintainer may follow up.