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

net/http: BenchmarkServerFakeConnNoKeepAlive can deadlock #5121

Closed
remyoudompheng opened this issue Mar 25, 2013 · 3 comments
Closed

net/http: BenchmarkServerFakeConnNoKeepAlive can deadlock #5121

remyoudompheng opened this issue Mar 25, 2013 · 3 comments

Comments

@remyoudompheng
Copy link
Contributor

What steps will reproduce the problem?
1. Run repeatedly

go test -race -run none -bench Fake -benchtime .6s -cpu=2,2,2,2,2,2,2,2              

What is the expected output? What do you see instead?

Expected: benchmark running.

Instead: after less than a dozen runs, the program locks.
A forced dump through SIGABRT gives:

SIGABRT: abort
PC=0x425361


goroutine 1 [chan receive]:
testing.(*B).run(0xc2000f11e0, 0x3, 0x7fb3e4fa0c08, 0x1, 0x1, ...)
    /opt/remy/go/src/pkg/testing/benchmark.go:168 +0x6a
testing.RunBenchmarks(0x7c6c60, 0x905ee0, 0x1, 0x1)
    /opt/remy/go/src/pkg/testing/benchmark.go:300 +0x8bb
testing.Main(0x7c6c60, 0x909900, 0x3, 0x3, 0x905ee0, ...)
    /opt/remy/go/src/pkg/testing/testing.go:366 +0x215
main.main()
    testhttp/_test/_testmain.go:51 +0xdb

goroutine 2 [syscall]:

goroutine 4 [chan receive]:
testhttp_test.BenchmarkServerFakeConnNoKeepAlive(0xc2000f11e0)
    /home/remy/travail/go/src/testhttp/serve_test.go:173 +0x515
testing.(*B).runN(0xc2000f11e0, 0x1388)
    /opt/remy/go/src/pkg/testing/benchmark.go:119 +0xbf
testing.(*B).launch(0xc2000f11e0)
    /opt/remy/go/src/pkg/testing/benchmark.go:204 +0x1c8
created by testing.(*B).run
    /opt/remy/go/src/pkg/testing/benchmark.go:167 +0x3a
rax     0xca
rbx     0xffffffffffffffff
rcx     0xffffffffffffffff
rdx     0x0
rdi     0x938118
rsi     0x0
rbp     0x938040
rsp     0x7fff58cc0b08
r8      0x0
r9      0x0
r10     0x0
r11     0x246
r12     0x7551c0
r13     0x75
r14     0x0
r15     0x0
rip     0x425361
rflags  0x246
cs      0x33
fs      0x0
gs      0x0
exit status 2
@bradfitz
Copy link
Contributor

Comment 1:

I can't reproduce on darwin-amd64 at 4c03cdfdff50 (Mon Mar 25 03:18:05 2013 +0800),
trying that command a number of times.

@remyoudompheng
Copy link
Contributor Author

Comment 2:

Apparently the test is just flaky with GOMAXPROCS>1. I can reproduce the deadlock with
revisions back to January, even without the race detector. I am on linux/amd64.
go test -test.run none -test.bench Fake -test.benchtime .6s -test.cpu=2,2,2,2,2 
PASS
BenchmarkServerFakeConnNoKeepAlive-2    fatal error: all goroutines are asleep - deadlock!
goroutine 1 [chan receive]:
testing.(*B).run(0xc2000703c0, 0x3, 0x7ffd3f853be0, 0x1)
    /opt/remy/go.clean2/src/pkg/testing/benchmark.go:168 +0x49
testing.RunBenchmarks(0x400c00, 0x70a998, 0x1, 0x1)
    /opt/remy/go.clean2/src/pkg/testing/benchmark.go:300 +0x4f9
testing.Main(0x400c00, 0x70d9d0, 0x3, 0x3, 0x70a998, ...)
    /opt/remy/go.clean2/src/pkg/testing/testing.go:330 +0x1af
main.main()
    testhttp/_test/_testmain.go:49 +0x9a
goroutine 3 [chan receive]:
testhttp.BenchmarkServerFakeConnNoKeepAlive(0xc2000703c0, 0x426a24)
    /home/remy/travail/go/src/testhttp/serve_test.go:172 +0x2dd
testing.(*B).runN(0xc2000703c0, 0x4e20, 0x4e20, 0x2710)
    /opt/remy/go.clean2/src/pkg/testing/benchmark.go:119 +0x83
testing.(*B).launch(0xc2000703c0, 0x0)
    /opt/remy/go.clean2/src/pkg/testing/benchmark.go:204 +0x134
created by testing.(*B).run
    /opt/remy/go.clean2/src/pkg/testing/benchmark.go:167 +0x2c
exit status 2
FAIL    testhttp    0.844s
The apparent lockup is because the latest network poller prevents the deadlock detection
from working.

@remyoudompheng
Copy link
Contributor Author

Comment 3:

This issue was closed by revision 3add0fe.

Status changed to Fixed.

@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
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