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

runtime/cgo: "pthread_create failed" during syscall.Exec on openSUSE #18381

Closed
peterGo opened this issue Dec 20, 2016 · 6 comments
Closed

runtime/cgo: "pthread_create failed" during syscall.Exec on openSUSE #18381

peterGo opened this issue Dec 20, 2016 · 6 comments
Labels
FrozenDueToAge Testing An issue that has been verified to require only test changes, not just a test failure.
Milestone

Comments

@peterGo
Copy link
Contributor

peterGo commented Dec 20, 2016

Please answer these questions before submitting your issue. Thanks!

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

go version devel +860c9c0 Tue Dec 20 05:06:55 2016 +0000 linux/amd64

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

go env
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/peter/gopath"
GORACE=""
GOROOT="/home/peter/go"
GOTOOLDIR="/home/peter/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build734889332=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"

What did you do?

If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.

see recipe

What did you expect to see?

./all.bash success

What did you see instead?

./all.bash failure

##### ../misc/cgo/test
--- FAIL: Test18146
	issue18146.go:96: syscall.Exec failed: exit status 2
		runtime/cgo: pthread_create failed: Resource temporarily unavailable

	issue18146.go:101: Failed 22 of 334 attempts.

Recipe

openSUSE Leap 42.2
https://en.opensuse.org/Portal:42.2

> uname -a
Linux linux-pdvp 4.4.36-8-default #1 SMP Fri Dec 9 16:18:38 UTC 2016 (3ec5648) x86_64 x86_64 x86_64 GNU/Linux
> systemd --version
systemd 228
+PAM -AUDIT +SELINUX -IMA +APPARMOR -SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT -GNUTLS +ACL +XZ -LZ4 +SECCOMP +BLKID -ELFUTILS +KMOD -IDN

~/go/src> ./make.bash
~/go/src> go version
go version devel +860c9c0 Tue Dec 20 05:06:55 2016 +0000 linux/amd64
~/go/src> go env
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/peter/gopath"
GORACE=""
GOROOT="/home/peter/go"
GOTOOLDIR="/home/peter/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build734889332=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"

~/go/src> ./all.bash

<SNIP>

##### ../misc/cgo/test
--- FAIL: Test18146 (1.75s)
	issue18146.go:96: syscall.Exec failed: exit status 2
		runtime/cgo: pthread_create failed: Resource temporarily unavailable
		SIGABRT: abort
		PC=0x7fdc522648d7 m=0 sigcode=18446744073709551610

		goroutine 0 [idle]:

		goroutine 34 [running]:
		runtime.systemstack_switch()
			/home/peter/go/src/runtime/asm_amd64.s:268 fp=0xc42011a5d0 sp=0xc42011a5c8
		runtime.startTheWorld()
			/home/peter/go/src/runtime/proc.go:936 +0x31 fp=0xc42011a5f0 sp=0xc42011a5d0
		runtime.GOMAXPROCS(0x1, 0x9)
			/home/peter/go/src/runtime/debug.go:33 +0xb9 fp=0xc42011a618 sp=0xc42011a5f0
		_/home/peter/go/misc/cgo/test.test18146(0xc4200ee1a0)
			/home/peter/go/misc/cgo/test/issue18146.go:41 +0xa11 fp=0xc42011a790 sp=0xc42011a618
		_/home/peter/go/misc/cgo/test.Test18146(0xc4200ee1a0)
			/home/peter/go/misc/cgo/test/cgo_unix_test.go:13 +0x2b fp=0xc42011a7a8 sp=0xc42011a790
		testing.tRunner(0xc4200ee1a0, 0x5f2c40)
			/home/peter/go/src/testing/testing.go:656 +0x93 fp=0xc42011a7d0 sp=0xc42011a7a8
		runtime.goexit()
			/home/peter/go/src/runtime/asm_amd64.s:2184 +0x1 fp=0xc42011a7d8 sp=0xc42011a7d0
		created by testing.(*T).Run
			/home/peter/go/src/testing/testing.go:693 +0x2c4

		goroutine 1 [chan receive]:
		runtime.gopark(0x5f5da8, 0xc4200f4298, 0x5e9c6d, 0xc, 0xc4200fc017, 0x3)
			/home/peter/go/src/runtime/proc.go:261 +0x13a fp=0xc420057b20 sp=0xc420057af0
		runtime.goparkunlock(0xc4200f4298, 0x5e9c6d, 0xc, 0x17, 0x3)
			/home/peter/go/src/runtime/proc.go:267 +0x5e fp=0xc420057b60 sp=0xc420057b20
		runtime.chanrecv(0x590340, 0xc4200f4240, 0x0, 0xc420057c01, 0x4c2f84)
			/home/peter/go/src/runtime/chan.go:513 +0x371 fp=0xc420057c00 sp=0xc420057b60
		runtime.chanrecv1(0x590340, 0xc4200f4240, 0x0)
			/home/peter/go/src/runtime/chan.go:395 +0x35 fp=0xc420057c38 sp=0xc420057c00
		testing.(*T).Run(0xc4200ee0d0, 0x5e8d9c, 0x9, 0x5f2c40, 0xc420057d01)
			/home/peter/go/src/testing/testing.go:694 +0x2ee fp=0xc420057ce0 sp=0xc420057c38
		testing.runTests.func1(0xc4200ee0d0)
			/home/peter/go/src/testing/testing.go:877 +0x67 fp=0xc420057d30 sp=0xc420057ce0
		testing.tRunner(0xc4200ee0d0, 0xc420057de0)
			/home/peter/go/src/testing/testing.go:656 +0x93 fp=0xc420057d58 sp=0xc420057d30
		testing.runTests(0xc4200f2000, 0x8d8c80, 0x4a, 0x4a, 0xc420057eb8)
			/home/peter/go/src/testing/testing.go:883 +0x29d fp=0xc420057e10 sp=0xc420057d58
		testing.(*M).Run(0xc420057f20, 0xc420057f20)
			/home/peter/go/src/testing/testing.go:818 +0xfc fp=0xc420057f00 sp=0xc420057e10
		main.main()
			_/home/peter/go/misc/cgo/test/_test/_testmain.go:188 +0xf7 fp=0xc420057f88 sp=0xc420057f00
		runtime.main()
			/home/peter/go/src/runtime/proc.go:185 +0x20a fp=0xc420057fe0 sp=0xc420057f88
		runtime.goexit()
			/home/peter/go/src/runtime/asm_amd64.s:2184 +0x1 fp=0xc420057fe8 sp=0xc420057fe0

		goroutine 17 [syscall, locked to thread]:
		runtime.goexit()
			/home/peter/go/src/runtime/asm_amd64.s:2184 +0x1 fp=0xc420046fe8 sp=0xc420046fe0

		goroutine 2 [force gc (idle)]:
		runtime.gopark(0x5f5da8, 0x8ed270, 0x5ea89d, 0xf, 0x5f5c14, 0x1)
			/home/peter/go/src/runtime/proc.go:261 +0x13a fp=0xc420034768 sp=0xc420034738
		runtime.goparkunlock(0x8ed270, 0x5ea89d, 0xf, 0xc420000114, 0x1)
			/home/peter/go/src/runtime/proc.go:267 +0x5e fp=0xc4200347a8 sp=0xc420034768
		runtime.forcegchelper()
			/home/peter/go/src/runtime/proc.go:226 +0x9e fp=0xc4200347e0 sp=0xc4200347a8
		runtime.goexit()
			/home/peter/go/src/runtime/asm_amd64.s:2184 +0x1 fp=0xc4200347e8 sp=0xc4200347e0
		created by runtime.init.4
			/home/peter/go/src/runtime/proc.go:215 +0x35

		goroutine 3 [GC sweep wait]:
		runtime.gopark(0x5f5da8, 0x8ed440, 0x5e9f84, 0xd, 0x423a14, 0x1)
			/home/peter/go/src/runtime/proc.go:261 +0x13a fp=0xc420034f58 sp=0xc420034f28
		runtime.goparkunlock(0x8ed440, 0x5e9f84, 0xd, 0x14, 0x1)
			/home/peter/go/src/runtime/proc.go:267 +0x5e fp=0xc420034f98 sp=0xc420034f58
		runtime.bgsweep(0xc420020070)
			/home/peter/go/src/runtime/mgcsweep.go:56 +0xb6 fp=0xc420034fd8 sp=0xc420034f98
		runtime.goexit()
			/home/peter/go/src/runtime/asm_amd64.s:2184 +0x1 fp=0xc420034fe0 sp=0xc420034fd8
		created by runtime.gcenable
			/home/peter/go/src/runtime/mgc.go:209 +0x61

		goroutine 18 [runnable]:
		runtime.runfinq()
			/home/peter/go/src/runtime/mfinal.go:147 fp=0xc4200307e0 sp=0xc4200307d8
		runtime.goexit()
			/home/peter/go/src/runtime/asm_amd64.s:2184 +0x1 fp=0xc4200307e8 sp=0xc4200307e0
		created by runtime.createfing
			/home/peter/go/src/runtime/mfinal.go:142 +0x62

		goroutine 19 [runnable]:
		os/signal.loop()
			/home/peter/go/src/os/signal/signal_unix.go:20 fp=0xc420030fe0 sp=0xc420030fd8
		runtime.goexit()
			/home/peter/go/src/runtime/asm_amd64.s:2184 +0x1 fp=0xc420030fe8 sp=0xc420030fe0
		created by os/signal.init.1
			/home/peter/go/src/os/signal/signal_unix.go:28 +0x41

		goroutine 20 [runnable, locked to thread]:
		runtime.cgocall(0x560100, 0xc4200317d0, 0x0)
			/home/peter/go/src/runtime/cgocall.go:131 +0xe2 fp=0xc420031790 sp=0xc420031750
		_/home/peter/go/misc/cgo/test._Cfunc_usleep(0x2710, 0x100c400000000)
			_/home/peter/go/misc/cgo/test/_test/_obj_test/_cgo_gotypes.go:1931 +0x4d fp=0xc4200317d0 sp=0xc420031790
		runtime.goexit()
			/home/peter/go/src/runtime/asm_amd64.s:2184 +0x1 fp=0xc4200317d8 sp=0xc4200317d0
		created by _/home/peter/go/misc/cgo/test.lockOSThreadCallback
			/home/peter/go/misc/cgo/test/issue3775.go:37 +0xe5

		rax    0x0
		rbx    0x7fdc525ce6b8
		rcx    0x7fdc522648d7
		rdx    0x6
		rdi    0x363e
		rsi    0x363e
		rbp    0x6073d2
		rsp    0x7ffc8419d828
		r8     0xa
		r9     0x7fdc52ef0740
		r10    0x8
		r11    0x202
		r12    0x202e2f0
		r13    0x34
		r14    0x0
		r15    0xf3
		rip    0x7fdc522648d7
		rflags 0x202
		cs     0x33
		fs     0x0
		gs     0x0
	issue18146.go:96: syscall.Exec failed: exit status 2
		runtime/cgo: pthread_create failed: Resource temporarily unavailable
		runtime/cgo: pthread_create failed: Resource temporarily unavailable
		SIGABRT: abort
		PC=0x7fd97b2618d7 m=2 sigcode=18446744073709551610

		goroutine 0 [idle]:

		goroutine 1 [runnable, locked to thread]:
		runtime.Gosched()
			/home/peter/go/src/runtime/proc.go:240 +0x1e
		_/home/peter/go/misc/cgo/test.lockOSThreadCallback()
			/home/peter/go/misc/cgo/test/issue3775.go:38 +0xea
		_/home/peter/go/misc/cgo/test._cgoexpwrap_adaf0d13d025_lockOSThreadCallback()
			_/home/peter/go/misc/cgo/test/_test/_obj_test/_cgo_gotypes.go:2427 +0x20
		_/home/peter/go/misc/cgo/test._Cfunc_lockOSThreadC()
			_/home/peter/go/misc/cgo/test/_test/_obj_test/_cgo_gotypes.go:1380 +0x41
		_/home/peter/go/misc/cgo/test.init.1()
			/home/peter/go/misc/cgo/test/issue3775.go:25 +0x20
		_/home/peter/go/misc/cgo/test.init()
			_/home/peter/go/misc/cgo/test/_test/_obj_test/_cgo_import.go:54 +0x2b8
		main.init()
			_/home/peter/go/misc/cgo/test/_test/_testmain.go:192 +0x53

		goroutine 17 [syscall, locked to thread]:
		runtime.goexit()
			/home/peter/go/src/runtime/asm_amd64.s:2184 +0x1

		goroutine 5 [syscall]:
		os/signal.signal_recv(0x0)
			/home/peter/go/src/runtime/sigqueue.go:116 +0x104
		os/signal.loop()
			/home/peter/go/src/os/signal/signal_unix.go:22 +0x22
		created by os/signal.init.1
			/home/peter/go/src/os/signal/signal_unix.go:28 +0x41

		rax    0x0
		rbx    0x7fd97b5cb6b8
		rcx    0x7fd97b2618d7
		rdx    0x6
		rdi    0x3660
		rsi    0x3739
		rbp    0x6073d2
		rsp    0x7fd97b22b948
		r8     0xa
		r9     0x7fd97b22c700
		r10    0x8
		r11    0x206
		r12    0x7fd96c0008c0
		r13    0x34
		r14    0x0
		r15    0xf3
		rip    0x7fd97b2618d7
		rflags 0x206
		cs     0x33
		fs     0x0
		gs     0x0


<SNIP>

	issue18146.go:96: syscall.Exec failed: exit status 2
		runtime/cgo: pthread_create failed: Resource temporarily unavailable
		SIGABRT: abort
		PC=0x7fd6c49e98d7 m=0 sigcode=18446744073709551610

		goroutine 0 [idle]:

		goroutine 1 [running]:
		runtime.systemstack_switch()
			/home/peter/go/src/runtime/asm_amd64.s:268 fp=0xc420034788 sp=0xc420034780
		runtime.main()
			/home/peter/go/src/runtime/proc.go:127 +0x6c fp=0xc4200347e0 sp=0xc420034788
		runtime.goexit()
			/home/peter/go/src/runtime/asm_amd64.s:2184 +0x1 fp=0xc4200347e8 sp=0xc4200347e0

		goroutine 17 [syscall, locked to thread]:
		runtime.goexit()
			/home/peter/go/src/runtime/asm_amd64.s:2184 +0x1 fp=0xc420046fe8 sp=0xc420046fe0

		rax    0x0
		rbx    0x7fd6c4d536b8
		rcx    0x7fd6c49e98d7
		rdx    0x6
		rdi    0x37b3
		rsi    0x37b3
		rbp    0x6073d2
		rsp    0x7ffcc364bd78
		r8     0xa
		r9     0x7fd6c5675740
		r10    0x8
		r11    0x202
		r12    0x1a4f050
		r13    0x34
		r14    0x0
		r15    0xf3
		rip    0x7fd6c49e98d7
		rflags 0x202
		cs     0x33
		fs     0x0
		gs     0x0
	issue18146.go:101: Failed 22 of 334 attempts.
FAIL
exit status 1
FAIL	_/home/peter/go/misc/cgo/test	3.352s
2016/12/20 01:37:41 Failed: exit status 1
@rakyll
Copy link
Contributor

rakyll commented Dec 21, 2016

Is this a regression in Go 1.8 or caused by an environmental setting change?

@ianlancetaylor
Copy link
Contributor

@rakyll The test is new in 1.8. The problem for which we are testing almost certainly exists in 1.7.

@peterGo What is the contents of the file /proc/sys/kernel/threads-max ? What is the output of bash -c "ulimit -u"?

@ianlancetaylor ianlancetaylor added this to the Go1.8Maybe milestone Dec 21, 2016
@ianlancetaylor ianlancetaylor added the Testing An issue that has been verified to require only test changes, not just a test failure. label Dec 21, 2016
@ianlancetaylor ianlancetaylor self-assigned this Dec 21, 2016
@peterGo
Copy link
Contributor Author

peterGo commented Dec 21, 2016

@ianlancetaylor Requested information:

> cat /proc/sys/kernel/threads-max
63091
> bash -c "ulimit -u"
1200
>

@peterGo peterGo closed this as completed Dec 21, 2016
@peterGo peterGo reopened this Dec 21, 2016
@ianlancetaylor
Copy link
Contributor

Thanks. It's the low 1200 number that is the problem here. I actually can't get anything done with ulimit -u set that low, but admittedly I run three separate Chrome processes.

@gopherbot
Copy link

CL https://golang.org/cl/34667 mentions this issue.

@peterGo
Copy link
Contributor Author

peterGo commented Dec 21, 2016

@ianlancetaylor Fixed. Thanks.

go version devel +d2512af Wed Dec 21 22:50:41 2016 +0000 linux/amd64
> ./all.bash
ALL TESTS PASSED

@golang golang locked and limited conversation to collaborators Dec 21, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge Testing An issue that has been verified to require only test changes, not just a test failure.
Projects
None yet
Development

No branches or pull requests

4 participants