From 71b13b5ac2a077b41174a08faa890f4f11e15041 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Tue, 2 Feb 2021 14:48:39 -0800 Subject: [PATCH] cmd/tailscale: fix IPN message reading stall in tailscale status -web Fixes #1234 Updates #1254 (cherry picked from commit 9a7078985338c4699228373b16d93d3227b3723e) --- cmd/tailscale/cli/status.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/cmd/tailscale/cli/status.go b/cmd/tailscale/cli/status.go index 022eb1328..f4f8c78ad 100644 --- a/cmd/tailscale/cli/status.go +++ b/cmd/tailscale/cli/status.go @@ -65,7 +65,17 @@ func runStatus(ctx context.Context, args []string) error { log.Fatal(*n.ErrMessage) } if n.Status != nil { - ch <- n.Status + select { + case ch <- n.Status: + default: + // A status update from somebody else's request. + // Ignoring this matters mostly for "tailscale status -web" + // mode, otherwise the channel send would block forever + // and pump would stop reading from tailscaled, which + // previously caused tailscaled to block (while holding + // a mutex), backing up unrelated clients. + // See https://github.com/tailscale/tailscale/issues/1234 + } } }) go pump(ctx, bc, c)