tailscale/control
Amal Bansode e32b9bde1d
control/controlclient: fix deadlock in map session change queue processing (#19828)
Holding an exclusive lock while writing to the unbuffered changequeue chan
is likely going to deadlock when the run() path may try to grab the same lock
before reading from the chan to drain it (on map session close). This causes
the client to stop processing new map responses and TSMP disco key advertisements.

There is a good probability of inducing this deadlock using the old code and new
test added in this commit: TestUpdateDiscoForNodeCallback/test_deadlock.

Also fix an unintentional regression in how the client responds to a mapResponse sleep
command. 85bb5f84a5 moved the processing of mapResponses into a new goroutine,
serialized via mapSession's changequeue. Thus, controlclient stopped sleeping in the
same goroutine servicing mapResponses/control connections. This commit brings us back
to sleeping synchronously in the same goroutine as controlclient.

Updates #12639

Signed-off-by: Amal Bansode <amal@tailscale.com>
Signed-off-by: Claus Lensbøl <claus@tailscale.com>
Co-authored-by: Claus Lensbøl <claus@tailscale.com>
2026-05-22 07:13:18 -07:00
..
controlbase control/controlbase: deflake, speed up TestConnMemoryOverhead 2026-03-06 06:19:11 -08:00
controlclient control/controlclient: fix deadlock in map session change queue processing (#19828) 2026-05-22 07:13:18 -07:00
controlhttp control/controlhttp: use ws:// when HTTPSPort is NoPort in JS dialer 2026-05-06 15:58:58 -07:00
controlknobs wgengine, all: remove LazyWG, use wireguard-go callback API for on-demand peers 2026-04-29 19:46:19 -07:00
ts2021 tsd, all: add Sys.ExtraRootCAs, plumb through TLS dial paths 2026-04-07 18:10:54 -07:00
tsp control/tsp, tstest/integration/testcontrol: deflake TestMapAgainstTestControl 2026-04-29 16:11:00 -07:00