mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
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#4540
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 @tradeahadi-cmyk on GitHub (Oct 14, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6820
Describe the bug
Summary
Thanks for the fix in #6795 (commit
4408333, released in v3.10.0). It works for VLESS: the node now applies pushed client changes in place and nobody on that port drops.Shadowsocks inbounds are still rebuilt. Every time the master pushes a client change (auto-disable on traffic/expiry, renew, reset, add, edit), the node does DelInbound + AddInbound on the Shadowsocks inbound, the listener closes, and every live connection on that port drops. The same happens on a local (non-node) inbound saved from the Edit Inbound form.
Environment
f8b72de)Steps to reproduce
Expected
Like VLESS since v3.10.0: only the changed client is removed/added through the Xray API, the listener stays up, other users keep their connections.
Actual
The node logs the inbound being deleted and re-added, and every client on the Shadowsocks port is disconnected. With thousands of clients, auto-disables happen often, so Shadowsocks users drop many times a day while VLESS users on the same node no longer do.
Root cause
internal/xray/hot_diff.goline 237 (same on v3.10.0 and dev):diffInboundUsers(line 245) returns false for any protocol not in this map, soInboundUserOpsfails andapplyInboundUserOpsininternal/web/service/inbound.go(around lines 2162 and 2238) falls through tort.DelInbound+rt.AddInbound.ComputeHotDiff(used bytryHotApplyininternal/web/service/xray.go) has the same limit.TestComputeHotDiff_ClientChangeFallsBackToReplacein hot_diff_test.go even uses "shadowsocks" as the example of an unsupported protocol.But per-user Shadowsocks changes are already supported elsewhere in the panel:
buildUserAccountininternal/xray/api.go(case "shadowsocks", ~line 657) builds both legacy AEAD and 2022 accounts, with tests in api_shadowsocks_test.go.XrayAPI.AddUser(~line 773) already handles the legacy Shadowsocks duplicate-email case.rt.AddUser/rt.RemoveUser.So the hot path is simply not enabled for Shadowsocks.
Suggested fix
userDiffableProtocolsfor multi-user inbounds (settings.clients present). Any change outside settings.clients (method, server password for 2022, network, etc.) is already caught by theoldRest/newRestcompare and still rebuilds.shadowsocksCipherNamereads "cipher" or "method";HealShadowsocksClientMethodswrites "method" onto legacy-cipher clients, but 2022 clients may not have it. Copying the inbound's settings.method into each emitted UserOp.User for shadowsocks would cover both. (If it is missing today, AddUser errors and the code already falls back to a rebuild, so this is safe either way.)Happy to test a build on a node with real load.
How to reproduce the problem
Expected behavior
Like VLESS since v3.10.0: only the changed client is removed/added through the Xray API, the listener stays up, other users keep their connections.
Actual behavior
No response
Relevant logs
Screenshots
No response
3x-ui version
3.10
Xray-core version
25.10.10
How did you install 3x-ui?
install.sh script
Operating system
Ubuntu 24
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
@github-actions[bot] commented on GitHub (Oct 14, 2026):
You're right: this is a real bug, and it is still in the code on
main(f8b72de9). The in-place client update added for #6795 only runs for a fixed list of protocols, and Shadowsocks is not on it. So any client change on a multi-user Shadowsocks inbound still goes throughDelInbound+AddInbound, and every connection on that port drops.How a pushed client change reaches the rebuild:
UpdateInboundfirst triesapplyInboundUserOps(internal/web/service/inbound.go:2162).falseas soon asxray.InboundUserOpsreturns!ok(inbound.go:2239-2241).InboundUserOpscallsdiffInboundUsers, which rejects any protocol missing from this map (internal/xray/hot_diff.go:237,:245):rt.DelInbound/rt.AddInbound(inbound.go:2166-2172), which closes the listener.The commit that fixed #6795 (
44083338, in v3.10.0) lists only those five protocols ("When only settings.clients differ (vless, vmess, trojan, hysteria, masque)"). Nothing in it says Shadowsocks was left out on purpose. The per-user Shadowsocks API path already exists and other client operations use it:buildUserAccountbuilds both the 2022 account and the legacy AEAD account (internal/xray/api.go:657-681).XrayAPI.AddUseralready handles the legacy duplicate-user case (api.go:773-775).Your second point is correct too, and it matters for the fix. The user map that
diffInboundUsersemits is the raw client object fromsettings.clients(hot_diff.go:271,:276). For 2022 ciphers,HealShadowsocksClientMethodsdeliberately removesmethodfrom each client (internal/database/model/model.go:626-628).shadowsocksCipherName(api.go:532-541) would then return""and the account build would fail withunknown cipher. Adding"shadowsocks"to the map alone would therefore keep rebuilding 2022 inbounds. It would not break anything, because a failedAddUserfalls back to a rebuild, but it would not fix them. Every other per-user Shadowsocks path already puts the inbound's method intouser["cipher"], for exampleinternal/web/service/inbound_traffic.go:374andclient_inbound_apply.go:613.Verdict: Confirmed bug
Severity: High
Confidence: High
Root cause:
internal/xray/hot_diff.go:237/diffInboundUsersat:245.userDiffableProtocolsleaves outshadowsocks, so a multi-user Shadowsocks inbound whose only change is insettings.clientsis never diffed per user and gets rebuilt. It came in withe5b56c94("fix(xray): reconcile client auto-disable through the API instead of a forced restart"), and44083338reused it for the node push path.Same class: (a)
ComputeHotDiff→diffInbounds→diffInboundUsers(hot_diff.go:155): the config-diff hot-apply path also removes and re-adds a Shadowsocks inbound for a client-only change, instead of applying per-user ops. (b) A local inbound saved from the Edit Inbound form takes the sameapplyInboundUserOps→DelInbound/AddInboundroute (inbound.go:2161-2172), as you describe.Already fixed: Still present on the default branch (
f8b72de9) and in v3.10.0.Duplicate of: Related: #6795 (the same fix, for the other protocols)
Evidence:
hot_diff.go:237,:245,:271;inbound.go:2162,:2239-2241,:2166-2172;api.go:532-541,:657-681;model.go:626-628;TestComputeHotDiff_ClientChangeFallsBackToReplace(internal/xray/hot_diff_test.go:243-245) uses"shadowsocks"as its "unsupported protocol" example. That test only uses Shadowsocks as a protocol not on the list; it does not argue that Shadowsocks should be rebuilt.Not determined: Whether every Xray-core build in use (you report 25.10.10) applies
AlterInboundadd/remove-user cleanly on a legacy multi-user Shadowsocks inbound. An end-to-end check against a real core settles it, for example a Shadowsocks case inTestXrayAPI_E2E_Users.Suggested fix: Add
shadowsockstouserDiffableProtocols, and havediffInboundUserscopy the inbound'ssettings.methodinto each emitted ShadowsocksUserOp.Userascipher. That fixes the node push path, the local edit path andComputeHotDifftogether. Changingmethod, the 2022 serverpasswordornetworkis already caught by theoldRest/newRestcompare and still triggers a rebuild. Without the cipher injection, 2022 inbounds would keep falling back to a rebuild.@MHSanaei
This reply was generated automatically; a maintainer may follow up.