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.
This commit is contained in:
parent
24234bf718
commit
e918a86028
1 changed files with 4 additions and 1 deletions
|
@ -1206,7 +1206,10 @@ class XMLStream(object):
|
||||||
if self.__thread_count != 0:
|
if self.__thread_count != 0:
|
||||||
log.error("Hanged threads: %s" % threading.enumerate())
|
log.error("Hanged threads: %s" % threading.enumerate())
|
||||||
log.error("This may be due to calling disconnect() " + \
|
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):
|
def process(self, **kwargs):
|
||||||
"""Initialize the XML streams and begin processing events.
|
"""Initialize the XML streams and begin processing events.
|
||||||
|
|
Loading…
Reference in a new issue