Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TBufferedServer: Avoid channel close/send race on Stop (#2583)
TBufferedServer.Close() may close the data channel before Serve detects it. Move chan close() to Serve to prevent a panic caused by sending on a closed channel. See also golang/go#27769 (comment) === RUN TestTBufferedServer_SendReceive ================== WARNING: DATA RACE Write at 0x00c000074850 by goroutine 9: runtime.closechan() /home/travis/.gimme/versions/go1.15.2.linux.amd64/src/runtime/chan.go:352 +0x0 github.com/jaegertracing/jaeger/cmd/agent/app/servers.(*TBufferedServer).Stop() ... Previous read at 0x00c000074850 by goroutine 10: runtime.chansend() /home/travis/.gimme/versions/go1.15.2.linux.amd64/src/runtime/chan.go:158 +0x0 github.com/jaegertracing/jaeger/cmd/agent/app/servers.(*TBufferedServer).Serve() /home/travis/gopath/src/github.com/jaegertracing/jaeger/cmd/agent/app/servers/tbuffered_server.go:97 +0x264 ... ================== testing.go:1042: race detected during execution of test --- FAIL: TestTBufferedServer_SendReceive (0.01s) Closes #2577 Signed-off-by: Carl Henrik Lunde <chlunde@ifi.uio.no>
- Loading branch information