Data race related to query Ack channel
dhiaayachi opened this issue · 0 comments
dhiaayachi commented
This is was discovered in the CI:
WARNING: DATA RACE
Write at 0x00c0001d4070 by goroutine 128:
runtime.closechan()
/opt/hostedtoolcache/go/1.16.15/x64/src/runtime/chan.go:355 +0x0
github.com/hashicorp/serf/serf.(*QueryResponse).Close()
/home/runner/work/serf/serf/serf/query.go:140 +0x158
github.com/hashicorp/serf/serf.(*Serf).registerQueryResponse.func1()
/home/runner/work/serf/serf/serf/serf.go:603 +0xd4
Previous read at 0x00c0001d4070 by goroutine 82:
runtime.chansend()
/opt/hostedtoolcache/go/1.16.15/x64/src/runtime/chan.go:158 +0x0
github.com/hashicorp/serf/serf.(*Serf).handleQueryResponse()
/home/runner/work/serf/serf/serf/serf.go:1428 +0x451
github.com/hashicorp/serf/serf.(*delegate).NotifyMsg()
/home/runner/work/serf/serf/serf/delegate.go:94 +0x1a18
github.com/hashicorp/memberlist.(*Memberlist).handleUser()
/home/runner/go/pkg/mod/github.com/hashicorp/memberlist@v0.3.0/net.go:753 +0x310
github.com/hashicorp/memberlist.(*Memberlist).packetHandler()
/home/runner/go/pkg/mod/github.com/hashicorp/memberlist@v0.3.0/net.go:516 +0x28a
Goroutine 128 (running) created at:
time.goFunc()
/opt/hostedtoolcache/go/1.16.15/x64/src/time/sleep.go:180 +0x51
Goroutine 82 (finished) created at:
github.com/hashicorp/memberlist.newMemberlist()
/home/runner/go/pkg/mod/github.com/hashicorp/memberlist@v0.3.0/memberlist.go:229 +0xa96
github.com/hashicorp/memberlist.Create()
/home/runner/go/pkg/mod/github.com/hashicorp/memberlist@v0.3.0/memberlist.go:239 +0x3c
github.com/hashicorp/serf/serf.Create()
/home/runner/work/serf/serf/serf/serf.go:409 +0x1494
github.com/hashicorp/serf/serf.TestSerf_Query()
/home/runner/work/serf/serf/serf/serf_test.go:2062 +0x450
testing.tRunner()
/opt/hostedtoolcache/go/1.16.15/x64/src/testing/testing.go:1203 +0x202
This is uncover a race where we write and close a channel in 2 different go routines. This is undefined behaviour and detected as a data race.