Closed kiqi007 closed 5 months ago
Hmmm, so we probably need to drain ackOut
and then call c.workers.Done()
before calling c.workers.Wait()
.
Hey there! Any idea when we might tackle this issue? Also, could anyone lend a hand with fixing it? I stumbled upon this while assisting my colleagues in debugging a memory leak, but I'm not very familiar with the MQTT library itself. So, if someone could help fix this problem, that would be great!
@kiqi007 I flagged it as "Help Wanted" because I doubt it's something I will get around to in the foreseeable future (don't ever call Disconnect
personally and am investing more time in the v5 client).
Issue Description: Encountered a goroutine leak scenario when using the MQTT package.
Local Reproduction Steps: Perform the following code changes and simulate network fluctuations.
Issue Cause: Within the code mentioned above, there is no call to Done() between Add() and Wait(), which causes the Wait() method to block indefinitely. To resolve this issue, a call to Done() needs to be properly placed.