tailscale/control/controlclient
Claus Lensbøl a85a4acce0
control/controlclient: fix deadlock in map session change queue processing (#19828) (#19904)
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




(cherry picked from commit e32b9bde1d)

Signed-off-by: Amal Bansode <amal@tailscale.com>
Signed-off-by: Claus Lensbøl <claus@tailscale.com>
Co-authored-by: Amal Bansode <amal@tailscale.com>
2026-05-28 10:37:31 -04:00
..
auto.go control/controlclient: handle 429 responses during node registration 2026-04-15 18:54:08 +01:00
client.go control,health,ipn: move IP forwarding check to health tracker (#19007) 2026-03-18 16:24:12 -04:00
controlclient_test.go control/controlclient: handle 429 responses during node registration 2026-04-15 18:54:08 +01:00
direct_test.go control/controlclient: handle 429 responses during node registration 2026-04-15 18:54:08 +01:00
direct.go control/controlclient: handle 429 responses during node registration 2026-04-15 18:54:08 +01:00
errors.go all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
map_debug.go control/controlclient: add patchify miss stats 2026-04-15 08:05:57 -07:00
map_test.go control/controlclient: fix deadlock in map session change queue processing (#19828) (#19904) 2026-05-28 10:37:31 -04:00
map.go control/controlclient: fix deadlock in map session change queue processing (#19828) (#19904) 2026-05-28 10:37:31 -04:00
sign_supported_test.go all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
sign_supported.go control/controlclient: enable request signatures on macOS (#19317) 2026-04-15 14:11:14 -04:00
sign_unsupported.go control/controlclient: enable request signatures on macOS (#19317) 2026-04-15 14:11:14 -04:00
sign.go all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
status.go all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00