Repository: go
Issue: all: some pkg tests fail for -test.count>1 but pass with -test.count=1
Labels: NeedsInvestigation

### What version of Go are you using (`go version`)?
tip

### Does this issue reproduce with the latest release?
yes

### What operating system and processor architecture are you using (`go env`)?
linux ppc64le

### What did you do?
Trying to run some tests multiple times to determine variations in times, but noticed that some tests fail when using count > 1 which pass for 1.

### What did you expect to see?
I would expect the count not to affect whether the test passes or fails.

### What did you see instead?
Failures in net/http/httputil, reflect, runtime/pprof.

2018/05/23 09:25:14 http: proxy error: EOF
2018/05/23 09:25:14 httputil: ReverseProxy read error during body copy: unexpected EOF
--- FAIL: TestDumpRequest (0.00s)
        dump_test.go:224: DumpRequest #7: http: invalid Read on closed Body
2018/05/23 09:25:14 http: proxy error: EOF
2018/05/23 09:25:14 httputil: ReverseProxy read error during body copy: unexpected EOF
--- FAIL: TestDumpRequest (0.00s)
        dump_test.go:224: DumpRequest #7: http: invalid Read on closed Body
2018/05/23 09:25:14 http: proxy error: EOF
2018/05/23 09:25:14 httputil: ReverseProxy read error during body copy: unexpected EOF
--- FAIL: TestDumpRequest (0.00s)
        dump_test.go:224: DumpRequest #7: http: invalid Read on closed Body
2018/05/23 09:25:14 http: proxy error: EOF
2018/05/23 09:25:14 httputil: ReverseProxy read error during body copy: unexpected EOF
FAIL
FAIL    net/http/httputil       0.346s

...

--- FAIL: TestCallReturnsEmpty (5.03s)
        all_test.go:1706: finalizer did not run
--- FAIL: TestCallReturnsEmpty (5.01s)
        all_test.go:1706: finalizer did not run
--- FAIL: TestCallReturnsEmpty (5.03s)
        all_test.go:1706: finalizer did not run
FAIL
FAIL    reflect 24.984s

...

--- FAIL: TestMutexProfile (0.08s)
    --- FAIL: TestMutexProfile/debug=1 (0.00s)
        pprof_test.go:689: received profile: --- mutex:
                cycles/second=511980172
                sampling period=1
                14132620 2 @ 0x701f8 0x17e08c 0x68bf4
                #       0x701f7         sync.(*Mutex).Unlock+0xb7               /home/boger/golang/fresh/go/src/sync/mutex.go:201
                #       0x17e08b        runtime/pprof.blockMutex.func1+0x3b     /home/boger/golang/fresh/go/src/runtime/pprof/pprof_test.go:651

        pprof_test.go:706: "14132620 2 @ 0x701f8 0x17e08c 0x68bf4" didn't match "^\\d+ 1 @(?: 0x[[:xdigit:]]+)+"
        pprof_test.go:712: --- mutex:
                cycles/second=511980172
                sampling period=1
                14132620 2 @ 0x701f8 0x17e08c 0x68bf4
                #       0x701f7         sync.(*Mutex).Unlock+0xb7               /home/boger/golang/fresh/go/src/sync/mutex.go:201
                #       0x17e08b        runtime/pprof.blockMutex.func1+0x3b     /home/boger/golang/fresh/go/src/runtime/pprof/pprof_test.go:651
--- FAIL: TestEmptyCallStack (0.00s)
panic: pprof: NewProfile name already in use: test18836 [recovered]
        panic: pprof: NewProfile name already in use: test18836

goroutine 711 [running]:
testing.tRunner.func1(0xc000694400)
        /home/boger/golang/fresh/go/src/testing/testing.go:792 +0x344
panic(0x1afa40, 0xc0000906e0)
        /home/boger/golang/fresh/go/src/runtime/panic.go:494 +0x1c0
runtime/pprof.NewProfile(0x1f5382, 0x9, 0x0)
        /home/boger/golang/fresh/go/src/runtime/pprof/pprof.go:214 +0x210
runtime/pprof.TestEmptyCallStack(0xc000694400)
        /home/boger/golang/fresh/go/src/runtime/pprof/pprof_test.go:830 +0x60
testing.tRunner(0xc000694400, 0x2022c0)
        /home/boger/golang/fresh/go/src/testing/testing.go:827 +0xc0
created by testing.(*T).Run
        /home/boger/golang/fresh/go/src/testing/testing.go:878 +0x2e0
FAIL    runtime/pprof   77.152s

Also, I have been trying to run benchmarks for atomics multiple times and while the tests don't fail, the first run (count=1) gives me a time that looks reasonable, but results for count>1 are really high.  This has me wondering if runs after the first are running with uninitialized data somewhere.

For example, the results when running -test.count=2
BenchmarkChanNonblocking-16    	1000000000	         3.15 ns/op
BenchmarkChanNonblocking-16    	1000000000	        32.7 ns/op

If I run the program for ChanNonblocking multiple times I consistently get results that are close to the first time within an expected variance.