disconnect(reconnect=False) does not always work #193

Open
horazont opened this Issue Aug 3, 2012 · 0 comments

Projects

None yet

1 participant

@horazont

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:

try:
    # do some work
finally:
    # whether wait is set to False doesn't matter
    self.disconnect(reconnect=False)

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    connecting...
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.

If I can do any help please just tell me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment