hmq
hmq copied to clipboard
data race
We are seeing this:
WARNING: DATA RACE
Write at 0x00c0008ca0b0 by goroutine 271:
github.com/fhmq/hmq/broker.(*client).Close()
/home/circleci/project/pkg/mod/github.com/fhmq/[email protected]/broker/client.go:611 +0xb2
github.com/fhmq/hmq/broker.ProcessMessage()
/home/circleci/project/pkg/mod/github.com/fhmq/[email protected]/broker/client.go:194 +0x411
github.com/fhmq/hmq/broker.(*Broker).SubmitWork.func1()
/home/circleci/project/pkg/mod/github.com/fhmq/[email protected]/broker/broker.go:110 +0x44
github.com/fhmq/hmq/pool.startWorker.func1()
/home/circleci/project/pkg/mod/github.com/fhmq/[email protected]/pool/fixpool.go:55 +0x31
Previous read at 0x00c0008ca0b0 by goroutine 160:
github.com/fhmq/hmq/broker.(*client).WriterPacket()
/home/circleci/project/pkg/mod/github.com/fhmq/[email protected]/broker/client.go:662 +0x45
github.com/fhmq/hmq/broker.publish()
/home/circleci/project/pkg/mod/github.com/fhmq/[email protected]/broker/comm.go:151 +0x84
github.com/fhmq/hmq/broker.(*client).ProcessPublishMessage()
/home/circleci/project/pkg/mod/github.com/fhmq/[email protected]/broker/client.go:326 +0x791
github.com/fhmq/hmq/broker.(*client).processClientPublish()
/home/circleci/project/pkg/mod/github.com/fhmq/[email protected]/broker/client.go:271 +0xbfd
github.com/fhmq/hmq/broker.(*client).ProcessPublish()
/home/circleci/project/pkg/mod/github.com/fhmq/[email protected]/broker/client.go:203 +0xa4
github.com/fhmq/hmq/broker.ProcessMessage()
/home/circleci/project/pkg/mod/github.com/fhmq/[email protected]/broker/client.go:177 +0x444
github.com/fhmq/hmq/broker.(*Broker).SubmitWork.func1()
/home/circleci/project/pkg/mod/github.com/fhmq/[email protected]/broker/broker.go:110 +0x44
github.com/fhmq/hmq/pool.startWorker.func1()
/home/circleci/project/pkg/mod/github.com/fhmq/[email protected]/pool/fixpool.go:55 +0x31
Goroutine 271 (running) created at:
github.com/fhmq/hmq/pool.startWorker()
/home/circleci/project/pkg/mod/github.com/fhmq/[email protected]/pool/fixpool.go:46 +0x4c
Goroutine 160 (running) created at:
github.com/fhmq/hmq/pool.startWorker()
/home/circleci/project/pkg/mod/github.com/fhmq/[email protected]/pool/fixpool.go:46 +0x4c
Data race means that some locking is missing. I briefly scanned the code, and I'm wondering whether the Client
should be locked for the duration of ProcessMessage
(there is a mutex mu
but it seems to be unused).
We are seeing this:
WARNING: DATA RACE Write at 0x00c0008ca0b0 by goroutine 271: github.com/fhmq/hmq/broker.(*client).Close() /home/circleci/project/pkg/mod/github.com/fhmq/[email protected]/broker/client.go:611 +0xb2 github.com/fhmq/hmq/broker.ProcessMessage() /home/circleci/project/pkg/mod/github.com/fhmq/[email protected]/broker/client.go:194 +0x411 github.com/fhmq/hmq/broker.(*Broker).SubmitWork.func1() /home/circleci/project/pkg/mod/github.com/fhmq/[email protected]/broker/broker.go:110 +0x44 github.com/fhmq/hmq/pool.startWorker.func1() /home/circleci/project/pkg/mod/github.com/fhmq/[email protected]/pool/fixpool.go:55 +0x31 Previous read at 0x00c0008ca0b0 by goroutine 160: github.com/fhmq/hmq/broker.(*client).WriterPacket() /home/circleci/project/pkg/mod/github.com/fhmq/[email protected]/broker/client.go:662 +0x45 github.com/fhmq/hmq/broker.publish() /home/circleci/project/pkg/mod/github.com/fhmq/[email protected]/broker/comm.go:151 +0x84 github.com/fhmq/hmq/broker.(*client).ProcessPublishMessage() /home/circleci/project/pkg/mod/github.com/fhmq/[email protected]/broker/client.go:326 +0x791 github.com/fhmq/hmq/broker.(*client).processClientPublish() /home/circleci/project/pkg/mod/github.com/fhmq/[email protected]/broker/client.go:271 +0xbfd github.com/fhmq/hmq/broker.(*client).ProcessPublish() /home/circleci/project/pkg/mod/github.com/fhmq/[email protected]/broker/client.go:203 +0xa4 github.com/fhmq/hmq/broker.ProcessMessage() /home/circleci/project/pkg/mod/github.com/fhmq/[email protected]/broker/client.go:177 +0x444 github.com/fhmq/hmq/broker.(*Broker).SubmitWork.func1() /home/circleci/project/pkg/mod/github.com/fhmq/[email protected]/broker/broker.go:110 +0x44 github.com/fhmq/hmq/pool.startWorker.func1() /home/circleci/project/pkg/mod/github.com/fhmq/[email protected]/pool/fixpool.go:55 +0x31 Goroutine 271 (running) created at: github.com/fhmq/hmq/pool.startWorker() /home/circleci/project/pkg/mod/github.com/fhmq/[email protected]/pool/fixpool.go:46 +0x4c Goroutine 160 (running) created at: github.com/fhmq/hmq/pool.startWorker() /home/circleci/project/pkg/mod/github.com/fhmq/[email protected]/pool/fixpool.go:46 +0x4c
Data race means that some locking is missing. I briefly scanned the code, and I'm wondering whether the
Client
should be locked for the duration ofProcessMessage
(there is a mutexmu
but it seems to be unused).
can you explain how to reproduce this issue?
Reported with more details on #153
this issue can be closed. It's fixed