From 6f694da91286ba5b86912d7237f57cd3216739bb Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Wed, 2 Oct 2024 18:10:20 -0700 Subject: [PATCH] wgengine/magicsock: avoid log spam from ReceiveFunc on shutdown The new logging in 2dd71e64ac11675e is spammy at shutdown: Receive func ReceiveIPv6 exiting with error: *net.OpError, read udp [::]:38869: raw-read udp6 [::]:38869: use of closed network connection Receive func ReceiveIPv4 exiting with error: *net.OpError, read udp 0.0.0.0:36123: raw-read udp4 0.0.0.0:36123: use of closed network connection Skip it if we're in the process of shutting down. Updates #10976 Change-Id: I4f6d1c68465557eb9ffe335d43d740e499ba9786 Signed-off-by: Brad Fitzpatrick --- wgengine/magicsock/magicsock.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wgengine/magicsock/magicsock.go b/wgengine/magicsock/magicsock.go index aceab3be5..08aff842d 100644 --- a/wgengine/magicsock/magicsock.go +++ b/wgengine/magicsock/magicsock.go @@ -1299,7 +1299,7 @@ func (c *Conn) mkReceiveFunc(ruc *RebindingUDPConn, healthItem *health.ReceiveFu healthItem.Enter() defer healthItem.Exit() defer func() { - if retErr != nil { + if retErr != nil && !c.closing.Load() { c.logf("Receive func %s exiting with error: %T, %v", healthItem.Name(), retErr, retErr) } }()