mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 19:11:53 +07:00
[GH-ISSUE #7093] [Bug]: Resetting all client traffic can hide new group usage #6616
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#6616
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 @BenjaminMitchell-D0FB on GitHub (Nov 7, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/7093
Describe the bug
Reset all client traffic clears client counters without shifting group baselines. A group can lose previously counted usage and suppress subsequent usage until its clients catch up to the stale baseline.
How to reproduce the problem
Expected behavior
The group download total increases by the new usage. Resetting client counters preserves the group accounting period, as it does for individual and selected-client resets.
Actual behavior
Client download shows about 50 MB, but the group remains at zero because its download baseline still holds about 500 MB. The display only starts to increase after the new cumulative download exceeds that baseline.
Relevant logs
Screenshots
No response
3x-ui version
3.11.0
Xray-core version
v26.10.21
How did you install 3x-ui?
Docker / Docker Compose
Operating system
Ubuntu 24.04
Which parts of the panel are affected?
Statistics / traffic counters
Browser (only if it is a UI bug)
Chrome
Is the panel behind a reverse proxy or CDN?
None
Before submitting
@github-actions[bot] commented on GitHub (Nov 7, 2026):
This is a real bug, and it is still present on the default branch. Clients → Reset all client traffic is the only client-reset path that zeroes
client_trafficswithout moving the group reset baselines. So the stale baseline gets subtracted from the new usage, and the group shows 0 until the clients' new cumulative traffic passes it.Why it happens
The Groups page shows each group's live sum of
client_trafficsminus its stored baseline (internal/web/service/client_groups.go:54-55):To keep that difference stable, every reset first shifts the baseline down by the counters it is about to zero. It calls
adjustGroupBaselinesForRemovedTraffic(client_groups.go:64-68, added in1153d5db"fix(groups): keep group traffic totals stable across client resets and deletes", for #5675). It is called from:internal/web/service/inbound_traffic.go:682and:790internal/web/service/client_traffic.go:101internal/web/service/client_traffic.go:202client_crud.go:1081,client_bulk.go:991,inbound_traffic.go:646,659ClientService.ResetAllTraffics(internal/web/service/client_traffic.go:241-282) never makes that call. It goes straight tozeroClientTraffics(tx, nil, keepOff)at line 255. This is the handler forPOST /panel/api/clients/resetAllTraffics(internal/web/controller/client.go:77,:365), which the Clients page calls (frontend/src/hooks/useClients.ts:527). In your steps: the group reset stores a ~500 MBResetDown; reset-all zeroes the client but leavesResetDownalone; 50 MB of new download then shows asmax(50 − 500, 0) = 0.It also breaks a group that was never reset. Its baseline is 0, so reset-all wipes the whole accumulated group total, which is the #5675 symptom again on this one path.
Workaround until it is fixed: after a global Reset all client traffic, run Reset traffic on each affected group from the Groups page. That recomputes the baseline from the current (now small) counters, and the group counts up normally from there. The group's usage from before the reset is not recovered. Resetting clients by selection, or per inbound, keeps group totals correct.
Suggested fix: in
ClientService.ResetAllTraffics, shift every group's baseline down by its current counters inside the same transaction, beforezeroClientTraffics. That is whatresetAllClientTrafficsLockedalready does for one inbound. Becauseemailsis nil here, the call needs either the full email list or a variant ofshiftGroupBaselinesthat sums over all grouped clients. A regression test next toTestGroupTotalsSurviveBulkClientResetthat callsResetAllTrafficswould cover it.This reply was generated automatically; a maintainer may follow up.