tianon/gosu

failed to create new OS thread (have 2 already; errno=22)

ciaranmcnulty opened this issue · 7 comments

I'm trying to build https://github.com/rodolpheche/wiremock-docker multi-arch from my M1 Mac.

The amd64 build gets the following error:

 RUN gosu nobody true:
#6 0.088 runtime: failed to create new OS thread (have 2 already; errno=22)
#6 0.088 fatal error: newosproc
#6 0.091 
#6 0.091 runtime stack:
#6 0.092 runtime.throw(0x4cb21f, 0x9)
#6 0.092        /usr/local/go/src/runtime/panic.go:566 +0x95
#6 0.092 runtime.newosproc(0xc420026000, 0xc420035fc0)
#6 0.092        /usr/local/go/src/runtime/os_linux.go:160 +0x194
#6 0.092 runtime.newm(0x4d6db8, 0x0)
#6 0.092        /usr/local/go/src/runtime/proc.go:1572 +0x132
#6 0.092 runtime.main.func1()
#6 0.092        /usr/local/go/src/runtime/proc.go:126 +0x36
#6 0.092 runtime.systemstack(0x53ae00)
#6 0.092        /usr/local/go/src/runtime/asm_amd64.s:298 +0x79
#6 0.093 runtime.mstart()
#6 0.093        /usr/local/go/src/runtime/proc.go:1079
#6 0.093 
#6 0.093 goroutine 1 [running]:
#6 0.093 runtime.systemstack_switch()
#6 0.093        /usr/local/go/src/runtime/asm_amd64.s:252 fp=0xc420020768 sp=0xc420020760
#6 0.093 runtime.main()
#6 0.093        /usr/local/go/src/runtime/proc.go:127 +0x6c fp=0xc4200207c0 sp=0xc420020768
#6 0.093 runtime.goexit()
#6 0.093        /usr/local/go/src/runtime/asm_amd64.s:2086 +0x1 fp=

I'm sure this is somehow caused by Qemu but thought I'd check here if there's any way of resolving?

Yeah, this is definitely caused by QEMU's user-mode emulation, which Go unfortunately doesn't officially support. 😞

(I'm not aware of anything that can be done here to fix it.)

Guess I need to look at other options - thanks for the quick response!

This probably needs to be reopened so someone can suggest a solution for this. I ran into this on Mac M1 too.

It may be something to raise upstream with Qemu or Go?

Actually... updating to gosu 1.14 has fixed this in my case I think

+1

same err with 1.10

Please try again with a recent release.