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 | 236c32faaef726f5c53af5d57a2c84fe02393104 (patch) | |
tree | 92979141c0914cdc4a1a45c3b89bc10569b880ab | |
parent | manager: print panics on all go routines not just main one (diff) | |
download | wireguard-windows-236c32faaef726f5c53af5d57a2c84fe02393104.tar.xz wireguard-windows-236c32faaef726f5c53af5d57a2c84fe02393104.zip |
manager: do not recycle tunnel tracker thread
-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) |