Description
Twice this week I've helped people debug panics in Go programs due to runtime/cgo: pthread_create failed: Resource temporarily unavailable
. Both times, it has turned out that they were calling syscall.Exec
and it happened to execute concurrently with a pthread_create
for a background goroutine, causing the pthread_create
to fail with EAGAIN
.
There have been a couple of previous threads on go-nuts involving similar issues.
We could consider modifying the runtime to stop the world and/or shutdown threads during calls to syscall.Exec
, but that seems like a fair amount of work and the syscall
package is frozen / deprecated anyway.
As a simpler step, I think we should have vet
warn about any calls to syscall.Exec
from outside the standard library.