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, net: the series of BenchmarkTCP fail from Go 1.5 when GOMAXPROCS is greater than # of CPU cores #13853

Closed
mikioh opened this issue Jan 7, 2016 · 1 comment

Comments

@mikioh
Copy link
Contributor

mikioh commented Jan 7, 2016

For example,

On Linux:

go test -v -run=none -bench=TCP -benchmem
PASS
BenchmarkTCP4OneShot-4                 30000       4566099 ns/op        1916 B/op         25 allocs/op
--- BENCH: BenchmarkTCP4OneShot-4
    tcp_test.go:138: dial tcp 127.0.0.1:34889: getsockopt: connection timed out
    tcp_test.go:138: dial tcp 127.0.0.1:34889: getsockopt: connection timed out
    tcp_test.go:138: dial tcp 127.0.0.1:34889: getsockopt: connection timed out
BenchmarkTCP4OneShotTimeout-4          20000         74035 ns/op        1902 B/op

Epoll or runtime.netpoll missed some write events?
On Darwin:

go test -v -run=none -bench=TCP -benchmem
PASS
BenchmarkTCP4OneShot-8                 10000        142858 ns/op        2123 B/op         25 allocs/op
--- BENCH: BenchmarkTCP4OneShot-8
    tcp_test.go:80: write tcp 127.0.0.1:59676->127.0.0.1:56708: write: socket is not connected
    tcp_test.go:80: write tcp 127.0.0.1:49711->127.0.0.1:56708: write: socket is not connected
BenchmarkTCP4OneShotTimeout-8           3000        360687 ns/op        2108 B/op         25 allocs/op

Kqueue or runtime.netpoll misrecognized writable sockets?
@ianlancetaylor ianlancetaylor added this to the Go1.6Maybe milestone Jan 7, 2016
@mikioh
Copy link
Contributor Author

mikioh commented Jan 8, 2016

Luckily this doesn't happen on Linux with ee566d5.

Also just scratched OS X 10.11 using dtrace and confirmed that the write syscall returns ENOTCONN certainly. Probably it's a kernel bug. Closing.

BenchmarkTCP4OneShot-8                 10000        142858 ns/op        2123 B/op         25 allocs/op
--- BENCH: BenchmarkTCP4OneShot-8
    tcp_test.go:80: s=27 write tcp 127.0.0.1:63425->127.0.0.1:60520: write: socket is not connected

sudo ./syscall.d 
dtrace: script './syscall.d' matched 10 probes
CPU     ID                    FUNCTION:NAME
  0    337                    connect:entry tid=449416 s=27
  0    338                   connect:return tid=449416 s=27 errno=36
  0    377                 getsockopt:entry tid=449419 s=27
  0    378                getsockopt:return tid=449419 s=27 errno=0
  0    149                      write:entry tid=449419 s=27
  0    150                     write:return tid=449419 s=27 errno=57

@mikioh mikioh closed this as completed Jan 8, 2016
@golang golang locked and limited conversation to collaborators Jan 7, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants