Ok, this is weird and this will probably be a hell to debug.
I have a short-living bot which is invoked on every git push, which sometimes refuses to die. I do something like that:
# do some work
# whether wait is set to False doesn't matter
in the session_start handler. However, in some cases, sleekxmpp will still reconnect. This is an excerpt from the debug log:
INFO Waiting for </stream:stream> from server
DEBUG Waiting for 3 threads to exit.
DEBUG Threading deadlock prevention!
DEBUG Marked scheduler_thread thread as ended due to disconnect() call. 2 threads remain.
DEBUG Stopped event runner thread. 1 threads remain.
DEBUG Stopped send thread. 0 threads remain.
DEBUG ==== TRANSITION connected -> disconnected
DEBUG Quitting Scheduler thread
DEBUG Finished exiting scheduler thread after early termination from disconnect() call. 0 threads remain.
DEBUG Waiting 1.950555289953954 seconds before connecting.
I found that I seem to be able to mitigiate the issue by setting self.auto_reconnect = False right before the disconnect call.
self.auto_reconnect = False
If I can do any help please just tell me.