summaryrefslogtreecommitdiff
path: root/sleekxmpp/xmlstream
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2012-05-10 10:22:38 -0700
committerLance Stout <lancestout@gmail.com>2012-05-10 10:22:38 -0700
commite918a860281675fc19c2c09bcf120c883ac7575f (patch)
tree21cd318072293e854349a6660d4f4d68c09c10db /sleekxmpp/xmlstream
parent24234bf7182066d6c2ee827c8121b8daede56663 (diff)
downloadslixmpp-e918a860281675fc19c2c09bcf120c883ac7575f.tar.gz
slixmpp-e918a860281675fc19c2c09bcf120c883ac7575f.tar.bz2
slixmpp-e918a860281675fc19c2c09bcf120c883ac7575f.tar.xz
slixmpp-e918a860281675fc19c2c09bcf120c883ac7575f.zip
Make the error message better regarding hanged threads.
All event handlers which call disconnect() MUST be registered using `add_event_handler(..., threaded=True)` in order to prevent temporarily deadlocking until a timeout occurs. This is required because disconnect() waits for the main threads to exit before returning, including the event processing thread. Since handlers registered without `threaded=True` run in the event processing thread, the disconnect() call will deadlock.
Diffstat (limited to 'sleekxmpp/xmlstream')
-rw-r--r--sleekxmpp/xmlstream/xmlstream.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/sleekxmpp/xmlstream/xmlstream.py b/sleekxmpp/xmlstream/xmlstream.py
index 34c9773c..daa1af1a 100644
--- a/sleekxmpp/xmlstream/xmlstream.py
+++ b/sleekxmpp/xmlstream/xmlstream.py
@@ -1206,7 +1206,10 @@ class XMLStream(object):
if self.__thread_count != 0:
log.error("Hanged threads: %s" % threading.enumerate())
log.error("This may be due to calling disconnect() " + \
- "from a non-threaded event handler.")
+ "from a non-threaded event handler. Be " + \
+ "sure that event handlers that call " + \
+ "disconnect() are registered using: " + \
+ "add_event_handler(..., threaded=True)")
def process(self, **kwargs):
"""Initialize the XML streams and begin processing events.