Closed yanmxa closed 1 month ago
Which version of the SDK are you using? Just checking because line 105 that you are probably referring to as the root cause in your stack above is currently returning an error: https://github.com/cloudevents/sdk-go/blob/1aecb204b50da7dae3d5586030c7047479334bdc/protocol/mqtt_paho/v2/protocol.go#L105
Have you tried the same with the paho.golang@v0.12.0/paho/client.go
directly to verify it's our SDK causing the race?
Yes. I use the paho.golang@v0.12.0
sdk directly to do the same thing. This issue hasn't appeared.
I launched 10 goroutines to send messages using the MQTT protocol. After a while, it might throw an error like this:
Code to reproduce the issue:
Error message:
The root cause is that these goroutines use the same object to load events. To resolve this, we must avoid using the same object in multiple goroutines.