2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-22 17:43:14 +00:00

Merge pull request #48 from jjohnson42/debugsignals

Add facility to dump trace to log
This commit is contained in:
Jarrod Johnson 2015-10-28 10:46:09 -04:00
commit d8c3b2f267

View File

@ -50,6 +50,8 @@ except ImportError:
import sys
import os
import signal
import time
import traceback
def _daemonize():
@ -119,6 +121,11 @@ def _checkpidfile():
def terminate(signalname, frame):
sys.exit(0)
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)))
ht.close()
def doexit():
if not havefcntl:
@ -138,6 +145,7 @@ def _initsecurity(config):
def run():
signal.signal(signal.SIGUSR1, dumptrace)
if havefcntl:
_checkpidfile()
conf.init_config()