mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[PR #6221] [MERGED] fix(node): keep disabled inbounds the node snapshot cannot report #6183
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#6183
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/6221
Author: @n0ctal
Created: 8/16/2026
Status: ✅ Merged
Merged: 8/18/2026
Merged by: @MHSanaei
Base:
main← Head:upstream-retain-disabled-inbounds📝 Commits (2)
c17007afix(node): keep disabled inbounds the node snapshot cannot report408f60achore: drop the accidentally committed dist build stub📊 Changes
2 files changed (+43 additions, -0 deletions)
View changed files
📝
internal/web/service/inbound_node.go(+6 -0)📝
internal/web/service/node_dirty_test.go(+37 -0)📄 Description
Summary
Creating a node inbound with
enable=falsedeletes it again within one sync interval. The row, its clients' traffic history and its port reservation are gone, on a healthy node, with nothing in the log.Why
AddInboundgates the entire node hand-off on the enable flag (internal/web/service/inbound.go:1078):For a disabled node inbound that means two things: it is never sent to the node, and the node is never marked dirty, so nothing schedules a later reconcile.
The orphan sweep in
setRemoteTrafficLockedthen runs under exactly the conditions it considers safe — node online, snapshot non-empty,dirty == false, tag managed — sees a central row the node does not report, and deletes it. The absence is real; it just means "never delivered", not "deleted on the node".A later
ReconcileNodewould have pushed it (it selects node inbounds without an enable filter), but the sweep gets there first.Scope
Six lines in the sweep plus a regression test: a central inbound with
Enable == falseis not swept.I want to be explicit about the alternative, because it is arguably the more complete fix: setting
markDirtyfor node inbounds regardless of the flag, so the reconcile delivers disabled inbounds too and the node's list agrees with the master. That is a larger behaviour change — it starts pushing configuration that is currently never sent — so this PR takes the conservative half and stops the data loss.Validation
TestSetRemoteTraffic_MissingDisabledInboundIsNotSweptomits a disabled inbound from the snapshot and asserts the row survives.disabled inbound rows=0, want 1— a behavioural failure, not a compile error.go build ./...,go vet,golangci-lint runclean;go test ./internal/web/servicegreen.Risk
Low. The change only narrows what the sweep may delete.
The cost is real and worth stating: an inbound deleted directly on the node while disabled centrally now lingers in the central DB until it is deleted there too. That is the same trade the existing empty-snapshot guard already makes — a stale row beats silent data loss.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.