Extend stackdump to display the daemonize status

The stackdump now tells us whether a thread is daemonized or not.
This is important whenever sys.exit is used as this call will wait
for any non-daemonized threads, possibly forever.

Change-Id: I4ebfe0db3ebecd75a3d8f21854dcd31c6fabdf78
This commit is contained in:
Markus Hosch 2018-01-29 10:48:41 +01:00
parent bdcd29b8fe
commit 750739b2c9
1 changed files with 4 additions and 1 deletions

View File

@ -59,9 +59,12 @@ def stack_dump_handler(signum, frame):
thread = threads.get(thread_id)
if thread:
thread_name = thread.name
thread_is_daemon = str(thread.daemon)
else:
thread_name = thread.ident
log_str += "Thread: %s %s\n" % (thread_id, thread_name)
thread_is_daemon = '(Unknown)'
log_str += "Thread: %s %s d: %s\n"\
% (thread_id, thread_name, thread_is_daemon)
log_str += "".join(traceback.format_stack(stack_frame))
log.debug(log_str)
except Exception: