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().
This commit is contained in:
parent
fd81bab906
commit
08716c35fd
1 changed files with 1 additions and 1 deletions
|
@ -1202,7 +1202,7 @@ class XMLStream(object):
|
||||||
if self.__thread_count != 0:
|
if self.__thread_count != 0:
|
||||||
log.debug("Waiting for %s threads to exit." %
|
log.debug("Waiting for %s threads to exit." %
|
||||||
self.__thread_count)
|
self.__thread_count)
|
||||||
self.__thread_cond.wait()
|
self.__thread_cond.wait(4)
|
||||||
if self.__thread_count != 0:
|
if self.__thread_count != 0:
|
||||||
raise Exception("Hanged threads: %s" % threading.enumerate())
|
raise Exception("Hanged threads: %s" % threading.enumerate())
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue