1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-26 09:47:58 +00:00

dump a trace on SIGUSR2

This commit is contained in:
Marian Beermann 2016-12-26 15:29:22 +01:00
parent d5bc486dc9
commit 0ff76bdc9d

View file

@ -3,6 +3,7 @@
from hashlib import sha256
from operator import attrgetter
import argparse
import faulthandler
import functools
import inspect
import os
@ -2021,6 +2022,11 @@ def sig_info_handler(sig_no, stack): # pragma: no cover
break
def sig_trace_handler(sig_no, stack): # pragma: no cover
print('\nReceived SIGUSR2 at %s, dumping trace...' % datetime.now().replace(microsecond=0), file=sys.stderr)
faulthandler.dump_traceback()
def main(): # pragma: no cover
# Make sure stdout and stderr have errors='replace') to avoid unicode
# issues when print()-ing unicode file names
@ -2036,6 +2042,7 @@ def main(): # pragma: no cover
signal_handler('SIGHUP', raising_signal_handler(SigHup)), \
signal_handler('SIGTERM', raising_signal_handler(SigTerm)), \
signal_handler('SIGUSR1', sig_info_handler), \
signal_handler('SIGUSR2', sig_trace_handler), \
signal_handler('SIGINFO', sig_info_handler):
archiver = Archiver()
msg = None