2
0
mirror of https://github.com/xcat2/confluent.git synced 2025-01-17 13:13:18 +00:00

Add thread traces to USR1 handler

When receiving a USR1 signal, it did usefully provide
'the' current stack, useful for diagnosing really hard
hangs.  However, it's frequently informative to see all
the thread stack traces, so add that data to the diagnostic
feature.
This commit is contained in:
Jarrod Johnson 2016-03-26 13:34:21 -04:00
parent 417e70e5c1
commit 2ea7ee0dcb

View File

@ -50,6 +50,8 @@ try:
except ImportError:
havefcntl = False
#import multiprocessing
import gc
from greenlet import greenlet
import sys
import os
import signal
@ -129,6 +131,13 @@ def dumptrace(signalname, frame):
ht = open('/var/log/confluent/hangtraces', 'a')
ht.write('Dumping active trace on ' + time.strftime('%X %x\n'))
ht.write(''.join(traceback.format_stack(frame)))
for o in gc.get_objects():
if not isinstance(o, greenlet):
continue
if not o:
continue
ht.write('Thread trace:\n')
ht.write(''.join(traceback.format_stack(o.gr_frame)))
ht.close()
def doexit():