diff options
author | Lance Stout <lancestout@gmail.com> | 2012-05-10 10:22:38 -0700 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2012-05-10 10:22:38 -0700 |
commit | e918a860281675fc19c2c09bcf120c883ac7575f (patch) | |
tree | 21cd318072293e854349a6660d4f4d68c09c10db /sleekxmpp/xmlstream | |
parent | 24234bf7182066d6c2ee827c8121b8daede56663 (diff) | |
download | slixmpp-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.py | 5 |
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. |