I haven't been able to write a succinct test case for this, but it's very reproducible in the context i'm running into it: a go binary windows service that uses https://github.com/shirou/gopsutil to gather cpu usage info. On first service start, the service is killed after the service timeout (30 seconds is the default, but after upping it to 70 seconds the hang persisted). Subsequent service starts work as expected. This behavior is the same whether the service is started by the system automatically, or with Start-Service in a privileged prompt.
Adding a 2-second timeout around the initial call to
DefaultClient.Query(query, dst, connectServerArgs...) seems to work around the problem (by failing the initial query, returning an error, and then working on subsequent calls).
I haven't been able to write a succinct test case for this, but it's very reproducible in the context i'm running into it: a go binary windows service that uses https://github.com/shirou/gopsutil to gather cpu usage info. On first service start, the service is killed after the service timeout (30 seconds is the default, but after upping it to 70 seconds the hang persisted). Subsequent service starts work as expected. This behavior is the same whether the service is started by the system automatically, or with
Start-Service
in a privileged prompt.Adding a 2-second timeout around the initial call to
DefaultClient.Query(query, dst, connectServerArgs...)
seems to work around the problem (by failing the initial query, returning an error, and then working on subsequent calls).