diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-08-19 15:20:42 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-08-19 15:20:42 +0200 |
commit | c28a350fa531b655d828534fe1dfc1e336612082 (patch) | |
tree | 92979141c0914cdc4a1a45c3b89bc10569b880ab /manager | |
parent | manager: print panics on all go routines not just main one (diff) | |
download | wireguard-windows-c28a350fa531b655d828534fe1dfc1e336612082.tar.xz wireguard-windows-c28a350fa531b655d828534fe1dfc1e336612082.zip |
manager: do not recycle tunnel tracker thread
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'manager')
-rw-r--r-- | manager/tunneltracker.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/manager/tunneltracker.go b/manager/tunneltracker.go index 32605b36..72942036 100644 --- a/manager/tunneltracker.go +++ b/manager/tunneltracker.go @@ -125,7 +125,15 @@ func trackTunnelService(tunnelName string, service *mgr.Service) { } runtime.LockOSThread() - defer runtime.UnlockOSThread() + + // This line would be fitting but is intentionally commented out: + // + // defer runtime.UnlockOSThread() + // + // The reason is that NotifyServiceStatusChange used queued APC, which winds up messing + // with the thread local context, which in turn appears to corrupt Go's own usage of TLS, + // leading to crashes sometime later (usually in runtime_unlock()) when the thread is recycled. + lastState := TunnelUnknown for { err := windows.NotifyServiceStatusChange(service.Handle, serviceNotifications, notifier) |