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#6491
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/6876
Author: @muditagrawal2007
Created: 10/19/2026
Status: ✅ Merged
Merged: 10/23/2026
Merged by: @alireza0
Base:
main← Head:fix/node-sync-matching-limits-stale-disable📝 Commits (2)
44c0e94fix(node-sync): do not latch node disable when master allows (#6870)085bf74fix(node-sync): keep node usage over quota latching a node disable📊 Changes
3 files changed (+72 additions, -32 deletions)
View changed files
📝
internal/database/dialect.go(+8 -8)📝
internal/web/service/inbound_node.go(+10 -11)📝
internal/web/service/node_client_expiry_sync_test.go(+54 -13)📄 Description
Summary
nodeDisableIsStaleandClientTrafficEnableMergeExprnow share one rule: a node-reportedenable=falseis stale when the master's own deadline and quota still permit the client. Matching limits no longer prove the verdict, so a single strayfalsefrom any source (a depleted snapshot the master later re-enabled, a staledisableInvalidClientshit, or a push that lagged a quota reset) is no longer latched onto the master forever.Why
Closes #6870. In a 1-master / 8-node deployment, ~2–3 of ~700 clients per day became desynced: one node flipped
enable=falsewith limits that matched the master's, the master latched the value as genuine, re-pushedfalseon the next traffic tick, and the cycle repeated. The user's only workaround was to delete the client on the affected node and let the master re-create it.The reproduction node-8 row ruled out every
disableInvalidClientsbranch (inbound_disable.go:46-53):up+downwas nowhere neartotal, expiry was in the future, and the global-traffic check did not match. The remaining writers ofclient_traffics.enableon a node areUpdateClientStat(driven by the master's push) anddisableInvalidClients— and the data showed it was the push.The latch was introduced by #4917 / #6228 with the assumption that "matching limits = node judged on the master's own terms." That assumption fails the moment the source of the false is anything other than the master's own depletion job (a quota reset the master forgot to push, a node that re-applied a stale snapshot, etc.). Replacing the assumption with the one the data supports keeps genuine depletion latches (combined-quota and expiry verifications on the master side) and breaks the unrecoverable loop.
Type of change
Areas affected
How was this tested?
Added two new sub-cases to
TestNodeDisableIsStale(internal/web/service/node_client_expiry_sync_test.go) andTestClientTrafficMergeSQLMatchesHelperscovering the exact reproduction: matching limits, master counts well below quota, node reportsenable=false— both the in-memory Go helper and the SQL UPDATE must keepenable=true. Both new cases fail against the previous code with the reported message (nodeDisableIsStale(...) = false, want true/helper expectation drift), then pass after the fix.TestNodeDisableIsStale/matching limits with empty counters are stale, not genuinewas the only pre-existing test case that locked in the buggy behavior (master-up + down was 0, which stillmasterLimitsAllowClient-allows). Renamed and flipped its expectation, and added the counterpartmatching limits and master over quota still latchto keep the genuine-latch invariant.TestNodeQuotaDisable_SameExpiryStillLatcheswas encoding the same bug under #4917's name: it pre-seeded the master withUp:0, Down:0(master allows) and expected the second sync'senable=falseto latch. Renamed toTestNodeQuotaDisable_MasterOverQuotaStillLatchesand pre-seeded the master atUp:80, Down:30(master disallows) so the genuine-latch invariant is what the test asserts.go test -count=1 -timeout 5m -shuffle=on ./...— full suite green.golangci-lint run— 0 issues.go build ./...— passes.Breaking changes
None. The placeholder signature of
ClientTrafficEnableMergeExpris internal; the only caller (mergeNodeClientTraffic) was updated in the same commit.Checklist
go build ./...and the test suite pass locally.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.