Commit 88752c93 authored by juga  's avatar juga
Browse files

scanner: log any exception raised by main_loop

before stopping the scanner.
parent 14b8ccf7
......@@ -36,6 +36,9 @@ pool = None
rd = None
controller = None
FILLUP_TICKET_MSG = """Something went wrong.
Please create a ticket in https://trac.torproject.org with this traceback."""
def stop_threads(signal, frame, exit_code=0):
global rd, pool
......@@ -540,14 +543,18 @@ def run_speedtest(args, conf):
fail_hard(error_msg)
max_pending_results = conf.getint('scanner', 'measurement_threads')
pool = Pool(max_pending_results)
try:
main_loop(args, conf, controller, rl, cb, rd, rp, destinations,
max_pending_results, pool)
except KeyboardInterrupt:
log.info("Interrupted by the user.")
finally:
stop_threads(signal.SIGINT, None)
# Any exception not catched at this point would make the scanner stall.
# Log it and exit gracefully.
except Exception as e:
log.critical(FILLUP_TICKET_MSG)
log.exception(e)
stop_threads(signal.SIGTERM, None, 1)
def gen_parser(sub):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment