From 08716c35fd3c19921cdc87fdaaec7ddc56e88bb5 Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Sun, 29 Apr 2012 14:45:00 -0700 Subject: Set a timeout when waiting for threads. If calling disconnect() from a non-threaded event handler, deadlock can happen as disconnect() is waiting for threads to close, but the event runner is blocked by a handler waiting for disconnect() to return. It is best to specify threaded=True for event handlers which may call disconnect(). --- sleekxmpp/xmlstream/xmlstream.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sleekxmpp/xmlstream/xmlstream.py b/sleekxmpp/xmlstream/xmlstream.py index d9e973ab..62083de8 100644 --- a/sleekxmpp/xmlstream/xmlstream.py +++ b/sleekxmpp/xmlstream/xmlstream.py @@ -1202,7 +1202,7 @@ class XMLStream(object): if self.__thread_count != 0: log.debug("Waiting for %s threads to exit." % self.__thread_count) - self.__thread_cond.wait() + self.__thread_cond.wait(4) if self.__thread_count != 0: raise Exception("Hanged threads: %s" % threading.enumerate()) -- cgit v1.2.3