mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[PR #5477] [MERGED] fix: resolve a batch of open bug-tagged issues (traffic accounting, share strategy, sub address, CPU) #5892
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#5892
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?
📋 Pull Request Information
Original PR: https://github.com/MHSanaei/3x-ui/pull/5477
Author: @MHSanaei
Created: 6/21/2026
Status: ✅ Merged
Merged: 6/21/2026
Merged by: @MHSanaei
Base:
main← Head:fix/open-bug-issues-sweep📝 Commits (5)
e59788bfix(node): never re-add a node's full counter on reset/restart (#5456, #5476, #5390)a0ea9c9fix(inbound): keep persisted node share strategy on edit (#5375)6a7495e<38b6ccebperf(traffic): skip cross-panel quota subquery when no globals exist (#5392, #5389)837300bfix(sub): don't advertise a leaked client IP for local wildcard inbounds (#5425)📊 Changes
26 files changed (+248 additions, -44 deletions)
View changed files
📝
frontend/src/pages/inbounds/InboundsPage.tsx(+2 -1)📝
frontend/src/pages/inbounds/form/InboundFormModal.tsx(+11 -1)📝
frontend/src/test/inbound-form-modal.test.tsx(+52 -1)📝
internal/database/index_tags_test.go(+2 -1)📝
internal/database/model/client_global_traffic.go(+1 -1)📝
internal/sub/build_urls_test.go(+25 -0)📝
internal/sub/service.go(+10 -4)📝
internal/web/service/client_traffic.go(+15 -1)📝
internal/web/service/global_traffic_test.go(+26 -0)📝
internal/web/service/inbound_disable.go(+23 -2)📝
internal/web/service/inbound_node.go(+2 -2)📝
internal/web/service/inbound_traffic.go(+8 -2)📝
internal/web/service/node_client_traffic_sum_test.go(+46 -3)📝
internal/web/translation/ar-EG.json(+2 -2)📝
internal/web/translation/en-US.json(+1 -1)📝
internal/web/translation/es-ES.json(+2 -2)📝
internal/web/translation/fa-IR.json(+2 -2)📝
internal/web/translation/id-ID.json(+2 -2)📝
internal/web/translation/ja-JP.json(+2 -2)📝
internal/web/translation/pt-BR.json(+2 -2)...and 6 more files
📄 Description
Sweep of open
bug-tagged issues. Each fix is a self-contained commit with tests; full backend (service/sub/database) and all 569 frontend tests pass.Fixes
Node traffic accounting —
fix(node)Fixes #5456, #5476, #5390
When a node's per-client counter dipped below the master's stored baseline (node reboot, xray restart, or a reset propagated to the node), the delta accounting clamped
deltato the node's whole current counter and re-added it to the master total — double-counting a client's lifetime usage in a single sync and often pushing them over quota. Now a backward-moving counter is treated as a reset: add0and rebaseline.Resets also clear the per-node
NodeClientTrafficbaseline (ResetClientTrafficByEmail,resetClientTrafficLocked,BulkResetTraffic,resetAllClientTrafficsLocked), so a node's pre-reset cumulative — including traffic it counted but had not yet synced — can't leak back after a reset ("reset reverts after a while").Share address strategy race —
fix(inbound)Fixes #5375
Opening the edit modal silently reverted
shareAddrStrategyfromnodetolisten: the downgrade effect fired before the form settled (availableNodesempty until/nodes/listresolves, andForm.useWatch('protocol')briefly empty on first edit render). Gated the downgrade on the nodes list being fetched and the protocol watch being settled.Hot query CPU —
perf(traffic)Fixes #5392, #5389
disableInvalidClientsran a correlatedEXISTSagainstclient_global_trafficsover the fullclient_trafficstable every 5s, pegging Postgres at 100% CPU on large client counts. On a panel no master pushes to, that table is empty, so the branch can never match — probe first and drop it (common case), and addidx_client_global_emailfor when globals are present. This also relieves the "traffic writer queue full" freeze (#5389), since the heavy query runs inside the serialized traffic write. Cross-panel enforcement is unchanged.Subscription address —
fix(sub)Fixes #5425
For a local inbound with no node, no custom share address, and a wildcard/blank listen,
resolveInboundAddressfell through to the subscriber's request host — which behind NAT/proxy/CDN can be the requesting client's own IP, so the subscription advertised the client's address. Now prefer the admin's configured Sub/Web domain over the raw request host for that last-resort fallback. Single-domain setups (no configured host) are unaffected.Notes
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.