aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/manager/tunneltracker.go
diff options
context:
space:
mode:
Diffstat (limited to 'manager/tunneltracker.go')
-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)