Closed RobertDeRose closed 8 months ago
@ralight I've search the issues and see others have reports this issue and stated that calling loop_start
instead of loop_forver
, however, loop_start
just calls loop_forever
on its own and this issue can happen and its not possible to catch it as it's inside an unmanaged thread.
This might not be to the correct fix, but it fixes it for me and I would assume others as if the Socket is None, there is no connection and the reconnect logic seems to kick in
@ralight and @PierreF hate to be a bother here, but this is causing me some headaches in a production environment and while I could make a fork and build my own version, It would be nice if one of the maintainers could confirm that this appears to be the correct fix. Thanks!
Would like to see this one on main, had same issue... Still couldn't face the root of cause
@gabrielgbs97
I gave up getting this PR merged. I ended up doing my own thread management
Just start your own thread, call loop_forver
inside a try..except
block and recall loop_fover
if an exception is thrown
The thread is simple a while True:
around the try...except
@ralight Please merge this PR, this caused seriously randomly issues in our production!
Thank for your contribution.
As I said in #505, I think the real fix would be to audit concurrency access and improve either locking or improve documentation on what could be called concurrently. In the meantime your fix seems simple and correct the the described problem.
Fixes https://github.com/eclipse/paho.mqtt.python/issues/505