From 37052fd5bc050f8eaf80b986d511f3c278233cca Mon Sep 17 00:00:00 2001 From: Viktor Liu <17948409+lixmal@users.noreply.github.com> Date: Thu, 21 May 2026 01:46:51 +0900 Subject: [PATCH] [client] Fix nil channel panic in external chain monitor stop (#6224) --- client/firewall/nftables/external_chain_monitor_linux.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/client/firewall/nftables/external_chain_monitor_linux.go b/client/firewall/nftables/external_chain_monitor_linux.go index 2a2e04c09..9c91c95cf 100644 --- a/client/firewall/nftables/external_chain_monitor_linux.go +++ b/client/firewall/nftables/external_chain_monitor_linux.go @@ -52,9 +52,10 @@ func (m *externalChainMonitor) start() { ctx, cancel := context.WithCancel(context.Background()) m.cancel = cancel - m.done = make(chan struct{}) + done := make(chan struct{}) + m.done = done - go m.run(ctx) + go m.run(ctx, done) } func (m *externalChainMonitor) stop() { @@ -72,8 +73,8 @@ func (m *externalChainMonitor) stop() { <-done } -func (m *externalChainMonitor) run(ctx context.Context) { - defer close(m.done) +func (m *externalChainMonitor) run(ctx context.Context, done chan struct{}) { + defer close(done) bo := &backoff.ExponentialBackOff{ InitialInterval: externalMonitorInitInterval,