Repository: go
Issue: x/net/nettest: TestTestConn runs out of memory on Plan 9
Labels: help wanted,OS-Plan9,NeedsFix

CL [37404](https://golang.org/cl/37404) added TestTestConn, which is running out of memory on Plan 9.

```
runtime: out of memory: cannot allocate 323485696-byte block (1029013504 in use)
fatal error: out of memory

runtime stack:
runtime.throw(0x11b06c, 0xd)
	/tmp/workdir/go/src/runtime/panic.go:596 +0x7b
runtime.largeAlloc(0x13478000, 0x100, 0x3)
	/tmp/workdir/go/src/runtime/malloc.go:816 +0xdf
runtime.mallocgc.func1()
	/tmp/workdir/go/src/runtime/malloc.go:709 +0x38
runtime.systemstack(0x103ee000)
	/tmp/workdir/go/src/runtime/asm_386.s:393 +0x5c
runtime.mstart()
	/tmp/workdir/go/src/runtime/proc.go:1116

goroutine 30390 [running]:
runtime.systemstack_switch()
	/tmp/workdir/go/src/runtime/asm_386.s:347 fp=0x103f4ddc sp=0x103f4dd8
runtime.mallocgc(0x13478000, 0x0, 0x0, 0xb)
	/tmp/workdir/go/src/runtime/malloc.go:708 +0x670 fp=0x103f4e30 sp=0x103f4ddc
runtime.growslice(0xfe140, 0x50b02000, 0xf6c6000, 0xf6c6000, 0xf6c6060, 0x212ac000, 0x4d, 0x50)
	/tmp/workdir/go/src/runtime/slice.go:140 +0x1bb fp=0x103f4e70 sp=0x103f4e30
testing.(*common).log(0x1044e240, 0x17d9e0a0, 0x4d)
	/tmp/workdir/go/src/testing/testing.go:551 +0x11f fp=0x103f4ea8 sp=0x103f4e70
testing.(*common).Errorf(0x1044e240, 0x11d4e9, 0x19, 0x103f4f18, 0x1, 0x1)
	/tmp/workdir/go/src/testing/testing.go:575 +0x5c fp=0x103f4ec8 sp=0x103f4ea8
vendor/golang_org/x/net/nettest.resyncConn(0x1044e240, 0x1a93a0, 0x107da4f8)
	/tmp/workdir/go/src/vendor/golang_org/x/net/nettest/conntest.go:435 +0x158 fp=0x103f4f24 sp=0x103f4ec8
vendor/golang_org/x/net/nettest.testConcurrentMethods(0x1044e240, 0x1a93a0, 0x107da4f8, 0x1a93a0, 0x107da520)
	/tmp/workdir/go/src/vendor/golang_org/x/net/nettest/conntest.go:382 +0x245 fp=0x103f4f58 sp=0x103f4f24
vendor/golang_org/x/net/nettest.timeoutWrapper(0x1044e240, 0x103ea328, 0x121b70)
	/tmp/workdir/go/src/vendor/golang_org/x/net/nettest/conntest.go:56 +0x1ab fp=0x103f4fac sp=0x103f4f58
vendor/golang_org/x/net/nettest.testConn.func11(0x1044e240)
	/tmp/workdir/go/src/vendor/golang_org/x/net/nettest/conntest_go17.go:23 +0x31 fp=0x103f4fbc sp=0x103f4fac
testing.tRunner(0x1044e240, 0x107da450)
	/tmp/workdir/go/src/testing/testing.go:747 +0xa5 fp=0x103f4fe8 sp=0x103f4fbc
runtime.goexit()
	/tmp/workdir/go/src/runtime/asm_386.s:1635 +0x1 fp=0x103f4fec sp=0x103f4fe8
created by testing.(*T).Run
	/tmp/workdir/go/src/testing/testing.go:789 +0x250

goroutine 1 [chan receive]:
testing.(*T).Run(0x1044e000, 0x11acd8, 0xc, 0x121b2c, 0x998d1)
	/tmp/workdir/go/src/testing/testing.go:790 +0x267
testing.runTests.func1(0x1044e000)
	/tmp/workdir/go/src/testing/testing.go:1004 +0x50
testing.tRunner(0x1044e000, 0x10411eec)
	/tmp/workdir/go/src/testing/testing.go:747 +0xa5
testing.runTests(0x103e8070, 0x1b8120, 0x1, 0x1, 0x0)
	/tmp/workdir/go/src/testing/testing.go:1002 +0x23f
testing.(*M).Run(0x1045bf98, 0x10414070)
	/tmp/workdir/go/src/testing/testing.go:921 +0xcc
main.main()
	vendor/golang_org/x/net/nettest/_test/_testmain.go:44 +0xc5

goroutine 6 [chan receive]:
testing.(*T).Run(0x1044e090, 0x1197f1, 0x3, 0x103ea308, 0x5134be)
	/tmp/workdir/go/src/testing/testing.go:790 +0x267
vendor/golang_org/x/net/nettest.TestTestConn(0x1044e090)
	/tmp/workdir/go/src/vendor/golang_org/x/net/nettest/conntest_test.go:76 +0xef
testing.tRunner(0x1044e090, 0x121b2c)
	/tmp/workdir/go/src/testing/testing.go:747 +0xa5
created by testing.(*T).Run
	/tmp/workdir/go/src/testing/testing.go:789 +0x250

goroutine 7 [chan receive]:
testing.(*T).Run(0x1044e1b0, 0x11b943, 0x11, 0x107da450, 0x303da101)
	/tmp/workdir/go/src/testing/testing.go:790 +0x267
vendor/golang_org/x/net/nettest.testConn(0x1044e1b0, 0x103ea328)
	/tmp/workdir/go/src/vendor/golang_org/x/net/nettest/conntest_go17.go:23 +0x3c6
vendor/golang_org/x/net/nettest.TestConn(0x1044e1b0, 0x103ea328)
	/tmp/workdir/go/src/vendor/golang_org/x/net/nettest/conntest.go:37 +0x28
vendor/golang_org/x/net/nettest.TestTestConn.func1(0x1044e1b0)
	/tmp/workdir/go/src/vendor/golang_org/x/net/nettest/conntest_test.go:123 +0x82
testing.tRunner(0x1044e1b0, 0x103ea308)
	/tmp/workdir/go/src/testing/testing.go:747 +0xa5
created by testing.(*T).Run
	/tmp/workdir/go/src/testing/testing.go:789 +0x250

goroutine 30393 [chan receive]:
internal/poll.(*asyncIO).Wait(...)
	/tmp/workdir/go/src/internal/poll/fd_io_plan9.go:84
internal/poll.(*FD).Read(0x10430460, 0x107db210, 0x10607c00, 0x400, 0x400, 0x0, 0x0, 0x0)
	/tmp/workdir/go/src/internal/poll/fd_plan9.go:73 +0x106
net.(*netFD).Read(0x10430460, 0x10607c00, 0x400, 0x400, 0x400, 0x0, 0x0)
	/tmp/workdir/go/src/net/fd_plan9.go:85 +0xb2
net.(*conn).Read(0x107da520, 0x10607c00, 0x400, 0x400, 0x0, 0x0, 0x0)
	/tmp/workdir/go/src/net/net.go:176 +0x55
go.(*struct { io.Reader }).Read(0x107da558, 0x10607c00, 0x400, 0x400, 0x400, 0x0, 0x0)
	<autogenerated>:1 +0x44
io.copyBuffer(0x1a7aa0, 0x107da550, 0x1a7a80, 0x107da558, 0x10607c00, 0x400, 0x400, 0x109affc4, 0x107da558, 0x107da558, ...)
	/tmp/workdir/go/src/io/io.go:390 +0xd8
io.CopyBuffer(0x1a7aa0, 0x107da550, 0x1a7a80, 0x107da558, 0x10607c00, 0x400, 0x400, 0x0, 0x103d4c40, 0x103d4c40, ...)
	/tmp/workdir/go/src/io/io.go:371 +0x5c
vendor/golang_org/x/net/nettest.chunkedCopy(0x1a7880, 0x107da520, 0x3043e0f0, 0x107da520, 0x103f4f60, 0x8)
	/tmp/workdir/go/src/vendor/golang_org/x/net/nettest/conntest.go:449 +0xe6
created by vendor/golang_org/x/net/nettest.testConcurrentMethods
	/tmp/workdir/go/src/vendor/golang_org/x/net/nettest/conntest.go:344 +0x9a

goroutine 31115 [syscall, locked to thread]:
syscall.Syscall6(0x8, 0x10607c00, 0x400, 0xffffffff, 0xffffffff, 0x0, 0x0, 0x1, 0x1, 0x0, ...)
	/tmp/workdir/go/src/syscall/asm_plan9_386.s:54 +0x5
syscall.Pread(0x8, 0x10607c00, 0x400, 0x400, 0xffffffff, 0xffffffff, 0x103ee000, 0x55239, 0x549d8)
	/tmp/workdir/go/src/syscall/zsyscall_plan9_386.go:218 +0x5c
syscall.Read(0x8, 0x10607c00, 0x400, 0x400, 0x0, 0x0, 0x0)
	/tmp/workdir/go/src/syscall/syscall_plan9.go:124 +0x48
os.fixCount(...)
	/tmp/workdir/go/src/os/file_plan9.go:249
os.(*File).read(0x107da508, 0x10607c00, 0x400, 0x400, 0x0, 0x14c3, 0x0)
	/tmp/workdir/go/src/os/file_plan9.go:249 +0x3c
os.(*File).Read(0x107da508, 0x10607c00, 0x400, 0x400, 0xffffffff, 0x0, 0x0)
	/tmp/workdir/go/src/os/file.go:103 +0x5d
os.(*File).Read-fm(0x10607c00, 0x400, 0x400, 0x400, 0x0, 0x0)
	/tmp/workdir/go/src/net/fd_plan9.go:85 +0x37
internal/poll.newAsyncIO.func1(0x107de3e0, 0x107db210, 0x10607c00, 0x400, 0x400)
	/tmp/workdir/go/src/internal/poll/fd_io_plan9.go:54 +0xc0
created by internal/poll.newAsyncIO
	/tmp/workdir/go/src/internal/poll/fd_io_plan9.go:43 +0xaf

goroutine 31112 [chan send]:
vendor/golang_org/x/net/nettest.resyncConn.func1(0x1a93a0, 0x107da4f8, 0x107e0880)
	/tmp/workdir/go/src/vendor/golang_org/x/net/nettest/conntest.go:426 +0x79
created by vendor/golang_org/x/net/nettest.resyncConn
	/tmp/workdir/go/src/vendor/golang_org/x/net/nettest/conntest.go:424 +0x8f
FAIL	vendor/golang_org/x/net/nettest	25.967s
```

See https://build.golang.org/log/91d479d449f2d4e18ff585e87fcf0867a4fd2ea7