aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-08-19 15:20:42 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2019-08-19 15:20:42 +0200
commit236c32faaef726f5c53af5d57a2c84fe02393104 (patch)
tree92979141c0914cdc4a1a45c3b89bc10569b880ab
parentmanager: print panics on all go routines not just main one (diff)
downloadwireguard-windows-236c32faaef726f5c53af5d57a2c84fe02393104.tar.xz
wireguard-windows-236c32faaef726f5c53af5d57a2c84fe02393104.zip
manager: do not recycle tunnel tracker thread
Diffstat (limited to '')
-rw-r--r--manager/tunneltracker.go10
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)