diff options
| author | Daniel Martí <mvdan@mvdan.cc> | 2017-10-12 11:57:36 +0100 |
|---|---|---|
| committer | Daniel Martí <mvdan@mvdan.cc> | 2017-10-13 15:19:59 +0000 |
| commit | 0e4de78d132677268d307f307c33831e17703195 (patch) | |
| tree | 3722579874d41a3d7a1acbb1721345aaadf4e010 /src/database/sql/sql.go | |
| parent | 743117a85e17070dcae010a14c6c1012bba298b0 (diff) | |
| download | go-0e4de78d132677268d307f307c33831e17703195.tar.xz | |
net: fix data race in TestClosingListener
In https://golang.org/cl/66334, the test was changed so that the second
Listen would also be closed. However, it shouldn't have reused the same
ln variable, as that can lead to a data race with the background loop
that accepts connections.
Simply define a new Listener, since we don't need to overwrite the first
variable.
I was able to reproduce the data race report locally about 10% of the
time by reducing the sleep from a millisecond to a nanosecond. After the
fix, it's entirely gone after 1000 runs.
Fixes #22226.
Change-Id: I7c639f9f2ee5098eac951a45f42f97758654eacd
Reviewed-on: https://go-review.googlesource.com/70230
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/database/sql/sql.go')
0 files changed, 0 insertions, 0 deletions
