server icon indicating copy to clipboard operation
server copied to clipboard

Concurrency issues when reading and writing retain messages

Open yh742 opened this issue 1 year ago • 4 comments

Hi there,

I'm trying to embed the broker into an application, but I've noticed while testing the library, the race detector goes off when publishing and subscribing to retain messages at the same time. I believe the issue is that there's no locks here:

https://github.com/mochi-co/mqtt/blob/7bd7bd5087c40f96015a61d01ce7ae4e6951c807/topics.go#L426-L428

And there's a lock here:

https://github.com/mochi-co/mqtt/blob/7bd7bd5087c40f96015a61d01ce7ae4e6951c807/topics.go#L354-L377

yh742 avatar Apr 17 '23 13:04 yh742