mirror of
https://github.com/tailscale/tailscale.git
synced 2026-11-24 02:31:18 -08:00
On Windows, winMon.Close unregisters the route/address/interface change callbacks and waits for in-flight ones to return. Those callbacks call Monitor.isActive, which takes m.mu. Monitor.Close held m.mu across om.Close, so a change notification arriving during Close deadlocked with it, and the test binary hung until the timeout. Release m.mu before calling om.Close. m.closed is already set under the lock, so late callbacks see the monitor as inactive and return. This is also the root cause of the Windows "ipnlocal: watchdog timeout" panics that kill the ipn/ipnlocal and wgengine/netstack test binaries. Add TestMonitorCloseWaitsForOSCallback, which uses a fake osMon whose Close, like winipcfg's Unregister, waits for a callback that needs m.mu. That reproduces the deadlock on any OS. flakestress TestMonitorCloseWaitsForOSCallback, -p 4, linux: before: 16/16 runs deadlocked after: 0/135569 runs Fixes #22228 Fixes #22548 Change-Id: Ibe7740ca23a1ab375d37c280838942f49b4a6a8f Signed-off-by: Nick Khyl <[email protected]> Signed-off-by: Brad Fitzpatrick <[email protected]>