[tor-commits] [stem/master] Make signal stacktrace more readable

atagar at torproject.org atagar at torproject.org
Wed Apr 10 19:53:09 UTC 2019


commit 505d9ecb1836a5f0d7f97290bb0b3ef532f198ba
Author: Damian Johnson <atagar at torproject.org>
Date:   Wed Apr 10 12:02:47 2019 -0700

    Make signal stacktrace more readable
    
    Shame on me for not exercising this new signal handler. I mistakenly dropped
    the join from teor's branch.
    
    Exercised this time by making a sleeping test and running "killall -s SIGUSR1
    python" to get...
    
      Signal 10 received. Traceback:
    
      File "./run_tests.py", line 413, in <module>
        main()
      File "./run_tests.py", line 189, in main
        test.task.PYCODESTYLE_TASK if not args.specific_test else None,
      File "/home/atagar/Desktop/stem/test/task.py", line 207, in run
        task.run()
      File "/home/atagar/Desktop/stem/test/task.py", line 303, in run
        return super(StaticCheckTask, self).run()
      File "/home/atagar/Desktop/stem/test/task.py", line 248, in run
        self._background_process = stem.util.system.DaemonTask(self.runner, self.args, start = True)
      File "/home/atagar/Desktop/stem/stem/util/system.py", line 253, in __init__
        self.run()
      File "/home/atagar/Desktop/stem/stem/util/system.py", line 264, in run
        self._process.start()
      File "/usr/lib/python2.7/multiprocessing/process.py", line 130, in start
        self._popen = Popen(self)
      File "/usr/lib/python2.7/multiprocessing/forking.py", line 126, in __init__
        code = process_obj._bootstrap()
      File "/usr/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap
        self.run()
      File "/usr/lib/python2.7/multiprocessing/process.py", line 114, in run
        self._target(*self._args, **self._kwargs)
      File "/home/atagar/Desktop/stem/stem/util/system.py", line 305, in _run_wrapper
        result = runner(*args) if args else runner()
      File "/home/atagar/Desktop/stem/stem/util/test_tools.py", line 620, in pyflakes_issues
        pyflakes.api.checkPath(path, reporter)
      File "/usr/local/lib/python2.7/dist-packages/pyflakes/api.py", line 108, in checkPath
        return check(codestr, filename, reporter)
      File "/usr/local/lib/python2.7/dist-packages/pyflakes/api.py", line 37, in check
        tree = compile(codeString, filename, "exec", _ast.PyCF_ONLY_AST)
---
 run_tests.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/run_tests.py b/run_tests.py
index f3959d01..3c1cde0e 100755
--- a/run_tests.py
+++ b/run_tests.py
@@ -77,7 +77,7 @@ def log_traceback(sig, frame):
   exit status -1 in the case of SIGABRT.
   """
 
-  print('Signal %s received.\nTraceback:\n%s' % (sig, traceback.format_stack(frame)))
+  print('Signal %s received. Traceback:\n\n%s' % (sig, ''.join(traceback.format_stack(frame))))
 
   if sig == signal.SIGABRT:
     sys.exit(-1)



More information about the tor-commits mailing list