[tor-commits] [sbws/master] scanner: Log callback error traceback
juga at torproject.org
juga at torproject.org
Thu Feb 28 11:09:52 UTC 2019
commit 8cbb73052240f685b409a89df910b915228c651c
Author: juga0 <juga at riseup.net>
Date: Wed Feb 27 17:07:21 2019 +0000
scanner: Log callback error traceback
Since the exception happens in a thread, not the main process,
use print_traceback to print the traceback.
---
sbws/core/scanner.py | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/sbws/core/scanner.py b/sbws/core/scanner.py
index 06bae72..e99b8cd 100644
--- a/sbws/core/scanner.py
+++ b/sbws/core/scanner.py
@@ -3,6 +3,7 @@
import signal
import sys
import threading
+import traceback
import uuid
from ..lib.circuitbuilder import GapsCircuitBuilder as CB
@@ -59,7 +60,6 @@ signal.signal(signal.SIGTERM, stop_threads)
def dumpstacks():
- import traceback
log.critical(FILLUP_TICKET_MSG)
thread_id2name = dict([(t.ident, t.name) for t in threading.enumerate()])
for thread_id, stack in sys._current_frames().items():
@@ -393,7 +393,11 @@ def result_putter_error(target):
def closure(object):
# The only object that can be here if there is not any uncatched
# exception is stem.SocketClosed when stopping sbws
- log.debug(type(object))
+ # An exception here means that the worker thread finished.
+ log.warning(FILLUP_TICKET_MSG)
+ # To print the traceback that happened in the thread, not here in the
+ # main process
+ traceback.print_exception(type(object), object, object.__traceback__)
return closure
More information about the tor-commits
mailing list