mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[PR #6219] [MERGED] fix(nodes): log the inbound the node snapshot removes centrally #6181
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#6181
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/6219
Author: @n0ctal
Created: 8/15/2026
Status: ✅ Merged
Merged: 8/16/2026
Merged by: @MHSanaei
Base:
main← Head:upstream-log-node-sweep📝 Commits (1)
5106cb2fix(nodes): log the inbound the node snapshot removes centrally📊 Changes
2 files changed (+53 additions, -0 deletions)
View changed files
📝
internal/web/service/inbound_node.go(+3 -0)➕
internal/web/service/inbound_node_sweep_log_test.go(+50 -0)📄 Description
Summary
The node-snapshot orphan sweep removes a central inbound and the traffic history of every client attached to it, and writes nothing to the log. This adds one warning naming the node, tag, id and port.
Why
When a node stops reporting an inbound, the master deletes the central row, its
client_trafficsrows and the per-node baselines. That is the correct behaviour — but it is invisible.The practical consequence is that two very different situations look identical from the outside: an inbound that was created and then swept, and an inbound that never reached the node at all. Both end as "the inbound I just added is gone", with an empty log either way. Working out which one happened currently means reading
setRemoteTrafficand reasoning aboutsnapTags.Every neighbouring branch in this function already logs — adoption conflicts, tag collisions, failed central creates. The one branch that destroys data is the quiet one.
Scope
internal/web/service/inbound_node.go: onelogger.Warningfbefore the sweep deletes, after the existingdirty/ empty-snapshot / kept-tag / unmanaged-tag guards, so it fires only when a removal actually follows.No behaviour change, no new condition — the same rows are deleted as before.
Validation
TestNodeSnapshotSweepLogsRemovedInbounddrives a real snapshot that reports one of two node inbounds, asserts the other is actually swept (so the log assertion cannot pass vacuously), and then requires the tag and id to appear in the warning log.sweep removed inbound "in-31777" (id 1) without naming it in the log.go build ./internal/...,go vet,golangci-lint run(0 issues),internal/web/servicetests andmake gen-checkall clean.Risk
Low. One log line on a path that already runs; nothing else changes. On a node that legitimately drops several inbounds at once this adds one warning per inbound — that seemed preferable to a summary line, since the point is to name exactly what was removed.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.