mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 19:11:53 +07:00
[GH-ISSUE #5597] [Bug]: Shadowsocks 2022 inbound requires full Xray restart after user renewal (runtime state not updated) #3910
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#3910
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 @mori-1997-mori2276-cmd on GitHub (Jun 27, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5597
Describe the bug
When using Shadowsocks 2022 (AEAD) in Xray/x-ui, user updates (renewal / expiry / traffic reset) are not reflected in the running Xray instance unless the service is fully restarted.
This results in inactive sessions for updated users until a restart is performed.
How to reproduce the problem
🔴 Observed Behavior:
✔️ Expected Behavior:
🟢 Comparison:
Expected behavior
No response
Actual behavior
No response
Relevant logs
Screenshots
No response
3x-ui version
3.4.1
Xray-core version
26.6.22
How did you install 3x-ui?
install.sh script
Operating system
24 & 26
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 (Jun 27, 2026):
This is a confirmed bug in the current source (v3.4.1). The root cause is in
internal/xray/api.go,AddUser(), lines 496–509.What happens
When
AddUseris called for a Shadowsocks inbound, it branches on the cipher string:All SS-2022 cipher methods (
2022-blake3-aes-128-gcm,2022-blake3-aes-256-gcm,2022-blake3-chacha20-poly1305) fall through todefault, givingCipherType_NONE, and then theelsebranch wraps ashadowsocks_2022.ServerConfigas the user account.shadowsocks_2022.ServerConfigis the inbound-level server configuration, not a per-user credential object. Passing it toAlterInboundwithAddUserOperationvia gRPC causes the operation to fail or have no effect in Xray-core's SS-2022 handler, because the expected type is a per-user account, not the full server config.How this maps to the symptom
The update path in
internal/web/service/client_inbound_apply.go(UpdateInboundClient, lines 667–699) does:rt.RemoveUser()to drop the old credential from the running instance — this succeeds.rt.AddUser()to re-register the updated credential — this fails for SS-2022 due to the wrong account type.needRestart = true.needRestart = truecauses the controller (internal/web/controller/client.go:173) to callxrayService.SetToNeedRestart(), which a 30-second cron job ininternal/web/web.go:315detects and uses to trigger a full Xray restart. Once restarted, Xray loads the inbound configuration from the database, correctly initializing the SS-2022 inbound with all clients.The same flaw affects traffic-reset re-enablement (
internal/web/service/inbound_traffic.go:571) and adding new clients to an SS-2022 inbound (internal/web/service/client_inbound_apply.go:396).Why VLESS works immediately
For VLESS,
AddUsersends&vless.Account{Id: uuid, Flow: flow}, which is the correct per-user type that Xray-core's VLESS handler accepts viaAddUserOperation. The gRPC call succeeds and the user is live in the running instance without any restart.Current workaround
The auto-restart triggered by
SetToNeedRestart()fires within 30 seconds of the update and restores the SS-2022 user. During that window, renewed or reset clients cannot connect becauseRemoveUsersucceeded butAddUserdid not. If you need instant availability after a renewal, trigger a manual Xray restart immediately via the panel restart button orx-ui→ option 3, rather than waiting for the automatic cycle.There is no panel setting that prevents this gap;
RestartXrayOnClientDisable(in Settings) only applies to automated traffic-limit disablement, not to manual client updates.Fix location
The fix is confined to
internal/xray/api.goAddUser(): for SS-2022 ciphers the code needs to pass the appropriate per-user account type (or, if Xray-core's gRPC handler does not support per-user add for SS-2022, an alternative approach such as full inbound replacement viaDelInbound+AddInboundwould be required). That determination depends on whether the running xray-core version exposes a compatibleAddUserpath for SS-2022 inbounds.This response was generated automatically; a maintainer may follow up.