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 ...@@ -36,6 +36,9 @@ pool = None
rd = None rd = None
controller = None controller = None
FILLUP_TICKET_MSG = """Something went wrong.
Please create a ticket in with this traceback."""
def stop_threads(signal, frame, exit_code=0): def stop_threads(signal, frame, exit_code=0):
global rd, pool global rd, pool
...@@ -540,14 +543,18 @@ def run_speedtest(args, conf): ...@@ -540,14 +543,18 @@ def run_speedtest(args, conf):
fail_hard(error_msg) fail_hard(error_msg)
max_pending_results = conf.getint('scanner', 'measurement_threads') max_pending_results = conf.getint('scanner', 'measurement_threads')
pool = Pool(max_pending_results) pool = Pool(max_pending_results)
try: try:
main_loop(args, conf, controller, rl, cb, rd, rp, destinations, main_loop(args, conf, controller, rl, cb, rd, rp, destinations,
max_pending_results, pool) max_pending_results, pool)
except KeyboardInterrupt: except KeyboardInterrupt:"Interrupted by the user.")"Interrupted by the user.")
stop_threads(signal.SIGINT, None) 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:
stop_threads(signal.SIGTERM, None, 1)
def gen_parser(sub): 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