From 439d84134d169db13b731a0cf515e0f5e342b984 Mon Sep 17 00:00:00 2001 From: James Tucker Date: Fri, 27 Feb 2026 19:09:24 -0800 Subject: [PATCH] tsnet: fix slow test shutdown leading to flakes TestDial in particular sometimes gets stuck in CI for minutes, letting chantun drop packets during shutdown avoids blocking shutdown. Updates #18423 Signed-off-by: James Tucker --- tsnet/tsnet_test.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tsnet/tsnet_test.go b/tsnet/tsnet_test.go index e2b37a365..9481defae 100644 --- a/tsnet/tsnet_test.go +++ b/tsnet/tsnet_test.go @@ -1881,8 +1881,8 @@ type chanTUN struct { func newChanTUN() *chanTUN { t := &chanTUN{ - Inbound: make(chan []byte, 10), - Outbound: make(chan []byte, 10), + Inbound: make(chan []byte, 1024), + Outbound: make(chan []byte, 1024), closed: make(chan struct{}), events: make(chan tun.Event, 1), } @@ -1922,6 +1922,10 @@ func (t *chanTUN) Write(bufs [][]byte, offset int) (int, error) { case <-t.closed: return 0, errors.New("closed") case t.Inbound <- slices.Clone(pkt): + default: + // Drop the packet if the channel is full, like a real + // TUN under congestion. This avoids blocking the + // WireGuard send path when no goroutine is draining. } } return len(bufs), nil