Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go tool compile: fork/exec /usr/local/go/pkg/tool/linux_amd64/compile: resource temporarily unavailable #50303

Closed
microyahoo opened this issue Dec 22, 2021 · 3 comments
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@microyahoo
Copy link

microyahoo commented Dec 22, 2021

What version of Go are you using (go version)?

(.venv) ➜ /home/deeproute/go/src/etcd-io/etcd ☞ git:(notes) go version                                          
go version go1.17.1 linux/amd64

Does this issue reproduce with the latest release?

What operating system and processor architecture are you using (go env)?

(.venv) ➜ /home/deeproute/go/src/etcd-io/etcd ☞ git:(notes) uname -a                            
Linux storage_cluster1 4.15.0-159-generic #167-Ubuntu SMP Tue Sep 21 08:55:05 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

(.venv) 🍺 /home/deeproute/go/src/etcd-io/etcd ☞ git:(notes) go env    
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/deeproute/.cache/go-build"
GOENV="/home/deeproute/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/deeproute/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/deeproute/go"
GOPRIVATE=""
GOPROXY="https://goproxy.cn"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.17.1"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/deeproute/go/src/etcd-io/etcd/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build2738182055=/tmp/go-build -gno-record-gcc-switches"

(.venv) 🍺 /home/deeproute/go/src/etcd-io/etcd ☞ git:(notes) gopls version                                       
golang.org/x/tools/gopls v0.7.1
    golang.org/x/tools/gopls@v0.7.1 h1:Mh3Z8Xcoq3Zy7ksSlwDV/nzQSbjFf06A+L+F8YHq55U=

What did you do?

go build and go tool compile will pop up errors when opening nvim as follows, but the build will come to normal after I close nvim.

(.venv) 🍺 /home/deeproute/go/src/etcd-io/etcd/server ☞ git:(notes) ✗ GOTRACEBACK=all go build -gcflags=all="-N -l" -o ../bin/etcd main.go
go tool compile: exit status 2
runtime: failed to create new OS thread (have 2 already; errno=11)
runtime: may need to increase max user processes (ulimit -u)
fatal error: newosproc

runtime stack:
runtime.throw({0xce7835, 0x7ffe5a0ecc98})
	/usr/local/go/src/runtime/panic.go:1198 +0x71
runtime.newosproc(0xc000020400)
	/usr/local/go/src/runtime/os_linux.go:160 +0x189
runtime.newm1(0xc000020400)
	/usr/local/go/src/runtime/proc.go:2251 +0xd3
runtime.newm(0x7ffe5a0ecd70, 0x0, 0x135d900)
	/usr/local/go/src/runtime/proc.go:2230 +0xe7
runtime.main.func1()
	/usr/local/go/src/runtime/proc.go:175 +0x29
runtime.systemstack()
	/usr/local/go/src/runtime/asm_amd64.s:383 +0x49

goroutine 1 [running]:
runtime.systemstack_switch()
	/usr/local/go/src/runtime/asm_amd64.s:350 fp=0xc000088780 sp=0xc000088778 pc=0x464ea0
runtime.main()
	/usr/local/go/src/runtime/proc.go:174 +0x7b fp=0xc0000887e0 sp=0xc000088780 pc=0x43785b
runtime.goexit()
	/usr/local/go/src/runtime/asm_amd64.s:1581 +0x1 fp=0xc0000887e8 sp=0xc0000887e0 pc=0x466f81

# retry again, but error message is different.
(.venv) 🍺 /home/deeproute/go/src/etcd-io/etcd/server ☞ git:(notes) ✗ GOTRACEBACK=all go build -gcflags=all="-N -l" -o ../bin/etcd main.go
go tool compile: fork/exec /usr/local/go/pkg/tool/linux_amd64/compile: resource temporarily unavailable
go tool compile: fork/exec /usr/local/go/pkg/tool/linux_amd64/compile: resource temporarily unavailable

(.venv) ➜ /home/deeproute/go/src/etcd-io/etcd/server ☞ git:(notes) ✗ ps -ef | grep nvim       
deeprou+ 1352316 1319378  0 02:52 pts/0    00:00:03 /tmp/.mount_nvimmGb6LB/usr/bin/nvim
deeprou+ 1352319       1  0 02:52 ?        00:00:00 nvim
deeprou+ 1352327 1352316  0 02:52 ?        00:00:05 /usr/local/bin/node --no-warnings /home/deeproute/.vim/plugged/coc.nvim/build/index.js
deeprou+ 1366693 1319378  0 03:13 pts/0    00:00:00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn --exclude-dir=.idea --exclude-dir=.tox nvim

(.venv) 🍺 /home/deeproute/go/src/etcd-io/etcd/server ☞ git:(notes) ✗ ps -ef | grep gopls
deeprou+ 1352373 1352316  0 02:52 ?        00:00:00 /home/deeproute/go/bin/gopls -remote=auto
deeprou+ 1352422 1352373  0 02:52 ?        00:00:09 /home/deeproute/go/bin/gopls serve -listen unix;/run/user/1000/gopls-64cf6b-daemon.deeproute -listen.timeout 1m0s
deeprou+ 1352429 1352327  0 02:52 ?        00:00:01 gopls
deeprou+ 1366794 1319378  0 03:13 pts/0    00:00:00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn --exclude-dir=.idea --exclude-dir=.tox gopls

(.venv) 🍺 /home/deeproute/go/src/etcd-io/etcd/server ☞ git:(notes) ✗ ps -ef | grep vim  
deeprou+ 1352316 1319378  0 02:52 pts/0    00:00:03 /tmp/.mount_nvimmGb6LB/usr/bin/nvim
deeprou+ 1352319       1  0 02:52 ?        00:00:00 nvim
deeprou+ 1352327 1352316  0 02:52 ?        00:00:05 /usr/local/bin/node --no-warnings /home/deeproute/.vim/plugged/coc.nvim/build/index.js
deeprou+ 1366844 1319378  0 03:13 pts/0    00:00:00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn --exclude-dir=.idea --exclude-dir=.tox vim

(.venv) 🍺 /home/deeproute/go/src/etcd-io/etcd/server ☞ git:(notes) ✗ cat /proc/sys/kernel/threads-max
3093214
(.venv) 🍺 /home/deeproute/go/src/etcd-io/etcd/server ☞ git:(notes) ✗ cat /proc/sys/kernel/pid_max    
4194304

(.venv) ➜ /home/deeproute/go/src/etcd-io/etcd/server ☞ git:(notes) ✗ ps -eLf | wc -l  
12222

image

What did you expect to see?

What did you see instead?

@microyahoo
Copy link
Author

microyahoo commented Dec 22, 2021

After upgrade to latest release go1.17.5, the issue still exists.

(.venv) 🍺 /home/deeproute/go/src/etcd-io/etcd/server ☞ git:(notes) go env                                              
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/deeproute/.cache/go-build"
GOENV="/home/deeproute/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/deeproute/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/deeproute/go"
GOPRIVATE=""
GOPROXY="https://goproxy.cn"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.17.5"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/deeproute/go/src/etcd-io/etcd/server/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build3159838994=/tmp/go-build -gno-record-gcc-switches"

(.venv) 🍺 /home/deeproute/go/src/etcd-io/etcd/server ☞ git:(notes) go build -gcflags=all="-N -l" -o ../bin/etcd main.go
# math/rand
runtime: failed to create new OS thread (have 3 already; errno=11)
runtime: may need to increase max user processes (ulimit -u)
fatal error: newosproc

runtime stack:
runtime.throw({0xce7855, 0x7fffe99a3310})
	/usr/local/go/src/runtime/panic.go:1198 +0x71
runtime.newosproc(0xc000020800)
	/usr/local/go/src/runtime/os_linux.go:160 +0x189
runtime.newm1(0xc000020800)
	/usr/local/go/src/runtime/proc.go:2251 +0xd3
runtime.newm(0xc000000680, 0xc000036800, 0x44043e)
	/usr/local/go/src/runtime/proc.go:2230 +0xe7
runtime.startm(0x0, 0x1)
	/usr/local/go/src/runtime/proc.go:2485 +0xcf
runtime.wakep()
	/usr/local/go/src/runtime/proc.go:2584 +0x5a
runtime.newproc.func1()
	/usr/local/go/src/runtime/proc.go:4261 +0x58
runtime.systemstack()
	/usr/local/go/src/runtime/asm_amd64.s:383 +0x49

goroutine 1 [running, locked to thread]:
runtime.systemstack_switch()
	/usr/local/go/src/runtime/asm_amd64.s:350 fp=0xc0000885e0 sp=0xc0000885d8 pc=0x464f00
runtime.newproc(0x12bac00, 0xd175d8)
	/usr/local/go/src/runtime/proc.go:4254 +0x6e fp=0xc000088628 sp=0xc0000885e0 pc=0x44010e
runtime.init.7()
	/usr/local/go/src/runtime/proc.go:294 +0x25 fp=0xc000088648 sp=0xc000088628 pc=0x437ba5
runtime.doInit(0x12b45a0)
	/usr/local/go/src/runtime/proc.go:6498 +0x123 fp=0xc000088780 sp=0xc000088648 pc=0x444c23
runtime.main()
	/usr/local/go/src/runtime/proc.go:204 +0x125 fp=0xc0000887e0 sp=0xc000088780 pc=0x437905
runtime.goexit()
	/usr/local/go/src/runtime/asm_amd64.s:1581 +0x1 fp=0xc0000887e8 sp=0xc0000887e0 pc=0x466fe1
# strconv
runtime: failed to create new OS thread (have 2 already; errno=11)
runtime: may need to increase max user processes (ulimit -u)
fatal error: newosproc

runtime stack:
runtime.throw({0xce7855, 0x7ffe12643e28})
	/usr/local/go/src/runtime/panic.go:1198 +0x71
runtime.newosproc(0xc000020400)
	/usr/local/go/src/runtime/os_linux.go:160 +0x189
runtime.newm1(0xc000020400)
	/usr/local/go/src/runtime/proc.go:2251 +0xd3
runtime.newm(0x7ffe12643f00, 0x0, 0x135d900)
	/usr/local/go/src/runtime/proc.go:2230 +0xe7
runtime.main.func1()
	/usr/local/go/src/runtime/proc.go:175 +0x29
runtime.systemstack()
	/usr/local/go/src/runtime/asm_amd64.s:383 +0x49

goroutine 1 [running]:
runtime.systemstack_switch()
	/usr/local/go/src/runtime/asm_amd64.s:350 fp=0xc000088780 sp=0xc000088778 pc=0x464f00
runtime.main()
	/usr/local/go/src/runtime/proc.go:174 +0x7b fp=0xc0000887e0 sp=0xc000088780 pc=0x43785b
runtime.goexit()
	/usr/local/go/src/runtime/asm_amd64.s:1581 +0x1 fp=0xc0000887e8 sp=0xc0000887e0 pc=0x466fe1
# syscall
runtime: failed to create new OS thread (have 2 already; errno=11)
runtime: may need to increase max user processes (ulimit -u)
fatal error: newosproc
........

image

exit status 2: stderr: runtime/cgo: pthread_create failed: Resource temporarily unavailable
SIGABRT: abort
PC=0x7f3f44fb8fb7 m=12 sigcode=18446744073709551610 

@dmitshur
Copy link
Contributor

Does the same problem happen if using go from the command line? If not, it looks like the problem is with in nvim and how it uses Go, and so this report would need to be made in its issue tracker. Please also see https://golang.org/wiki/Questions.

@dmitshur dmitshur added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Dec 22, 2021
@microyahoo
Copy link
Author

The issue has gone after reboot this server.

@golang golang locked and limited conversation to collaborators Dec 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

3 participants