go: runtime: intermittent "failed to create new OS thread" on Windows since 2022-01-24

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
runtime: failed to create new OS thread (22)
FAIL	golang.org/x/tools/go/packages	25.671s

greplogs --dashboard -md -l -e '(?ms)\Awindows-.*runtime: failed to create new OS thread'

2022-04-26T02:30:39-5bb9a5e-17d7983/windows-amd64-race 2022-03-21T13:26:21-86b02b3-4aa1efe/windows-arm64-11 2022-02-04T14:02:15-25d2ab2-4afcc9f/windows-arm64-11 2022-01-24T16:55:59-f9df4ea/windows-amd64-2008

Curiously, I don’t see any of these errors in the logs before 2022-01-24. 🤔

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 18 (15 by maintainers)

Commits related to this issue

Most upvoted comments

I haven’t been able to reproduce this issue with CL 410355, so closing for now, though of course that CL isn’t a hard fix so we’ll see if this comes back.

Since there’s a decent chance this is resource exhaustion on the builders I’m not sure this is going to impede users using the beta, so marking as okay-after-beta1.

“runtime: failed to create new OS thread (13)” is errno EACCES. _beginthread “may return EACCES if there are insufficient resources (such as memory)”, which fits well with the out-of-memory errors.

I reproduced this 12 times over the weekend on gomotes, interestingly always in package runtime’s TestCgoSignalDeadlock:

--- FAIL: TestCgoSignalDeadlock (44.53s)
    crash_test.go:124: running go build -o C:\Users\gopher\AppData\Local\Temp\1\go-build3458167679\testprogcgo.exe 
    crash_cgo_test.go:37: expected "OK\n", but got:
        OK
        
        This application has requested the Runtime to terminate it in an unusual way.
        Please contact the application's support team for more information.
        runtime: failed to create new OS thread (13)
FAIL
FAIL    runtime 418.665s