-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Description
What version of Go are you using (go version)?
$ go version go version go1.12.6 linux/amd64
Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (go env)?
go env Output
$ go env GOARCH="amd64" GOBIN="" GOCACHE="/home/ubuntu/.cache/go-build" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOOS="linux" GOPATH="/home/ubuntu/go" GOPROXY="" GORACE="" GOROOT="/usr/local/go" GOTMPDIR="" GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64" GCCGO="gccgo" CC="gcc" CXX="g++" CGO_ENABLED="1" GOMOD="" 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-build117733995=/tmp/go-build -gno-record-gcc-switches"
What did you do?
Ran a simple program which launches a configurable number of goroutines all which do CPU intensive work in a tight loop. It also imports net/http/pprof and starts a server to expose the debugging endpoint.
go get github.com/jaffee/pegger/cmd/pegger
pegger -concurrency 3
# in another terminal:
go tool pprof localhost:6060/debug/pprof/profile?seconds=3
Try setting the concurrency argument lower than what runtime.NumCPU() reports on your system. By default it is equal to runtime.NumCPU().
What did you expect to see?
A profile after 3ish seconds.
What did you see instead?
A few different things:
$ go tool pprof localhost:6060/debug/pprof/profile
Fetching profile over HTTP from http://localhost:6060/debug/pprof/profile
localhost:6060/debug/pprof/profile: Get http://localhost:6060/debug/pprof/profile: net/http: timeout awaiting response headers
failed to fetch any source profiles
$ go tool pprof localhost:6060/debug/pprof/profile
Fetching profile over HTTP from http://localhost:6060/debug/pprof/profile
localhost:6060/debug/pprof/profile: Get http://localhost:6060/debug/pprof/profile: dial tcp 127.0.0.1:6060: connect: connection refused
failed to fetch any source profiles
On OSX, I see the connection refused message if -concurrency is equal to the number of hardware threads available, and otherwise it works.
On a 32 core Linux VM in Azure, I've seen both the timeout and connection refused messages at concurrencies ranging from 2 to 32. At concurrency 1, things work as expected. At concurrency 2, I've seen it work, but it usually doesn't. It has failed consistently at all higher concurrencies in my testing.
I can understand why, if I have 8 cores, and I'm running 8 goroutines all in tight loops, that nothing else might get to run, and so I wouldn't be able to connect to the debug endpoint. But why if I'm only running 3 or 4 goroutines on a 32 core machine?