fhmq/hmq

Race condition on client close

lucasvmx opened this issue · 1 comments

How to reproduce

  • go run -race main.go
  • mosquitto_sub -t test -i "evil subscriber" -q 1
  • mosquitto_pub -t test -i "evil publisher" -m "hello world" -q 1
  • close mosquitto_sub with Ctrl + C
  • race condition should be triggered in ~20 seconds after message has been published
  • if more than 20 seconds has been passed, race condition should be triggered immediately after you press Ctrl + C

Notes

Can be triggered with QoS 1 or 2
Multiple race conditions must be shown but one of them should be fixed by #152

Logs

{"level":"info","timestamp":"2022-03-31T20:18:13.410-0300","logger":"broker","caller":"broker/broker.go:191","msg":"Start Listening client on ","hp":"0.0.0.0:1883"}
{"level":"info","timestamp":"2022-03-31T20:18:15.647-0300","logger":"broker","caller":"broker/broker.go:286","msg":"read connect from ","clientID":"evil subscriber"}
{"level":"info","timestamp":"2022-03-31T20:18:32.447-0300","logger":"broker","caller":"broker/broker.go:286","msg":"read connect from ","clientID":"evil publisher"}

Result

image

@lucas-engen @chowyu08 this issue can be closed