"runtime: failed to create new OS thread" and "fatal error: runtime.newosproc" in 32-bit Windows

First of all, I am not a professional developer/programmer, so please forgive me for any shortcomings in my explanation. I have encountered this problem while running Syncthing, which is written in Golang.

Basically, the program crashed with the following errors:

runtime: failed to create new OS thread (have 1192 already; errno=8)
Panic at 2020-10-28T21:25:20+09:00
fatal error: runtime.newosproc

runtime stack:
runtime.throw(0x120fa12, 0x11)
	runtime/panic.go:1116 +0x64
	runtime/os_windows.go:794 +0x146
	runtime/proc.go:1829 +0xbd
runtime.newm(0x13e5b7c, 0x12c2c000, 0x4a7, 0x0)
	runtime/proc.go:1808 +0x81
runtime.startm(0x12c2c000, 0x1)
	runtime/proc.go:1965 +0xac
	runtime/proc.go:2004 +0x28c
runtime.retake(0x68d8ec28, 0x4587, 0x0)
	runtime/proc.go:4805 +0x171
	runtime/proc.go:4713 +0x275
	runtime/proc.go:1172 +0x9b
	runtime/proc.go:1137 +0x51

The full panic log from Syncthing is available under https://github.com/syncthing/syncthing/files/5452199/panic-20201028-212520.log.

I have reported the problem on the Syncthing’s issue tracker, but the developers said that it might be either a problem with the Go runtime or the OS, hence my question here.

My guess is that this may be somewhat related to the 2000 threads per process limitation in the 32-bit Windows explained in https://devblogs.microsoft.com/oldnewthing/?p=34773, but I have no confirmation of that. The crash did happen with Syncthing running under Windows 10 Enterprise LTSB 2016 x86 (i.e. 32-bit Windows).

Is this something that could be fixed/prevented either in Syncthing or the Go runtime, or is this a limitation of running a Go application under the 32-bit Windows? In the blog post linked above, Microsoft mentions tweaking the code to “squick in” more threads, but I have no idea how that would correspond to a code written in Go.

github .com/syncthing/syncthing/issues/7064
github .com/golang/go/issues/42253

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.