Opened 3 years ago

Closed 3 years ago

#13390 closed defect (fixed)

If there are no bandwidth authorities, doctor crashes

Reported by: tom Owned by: atagar
Priority: Medium Milestone:
Component: Core Tor/DocTor Version:
Severity: Keywords:
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

If there are no bandwidth authorities (or presumably, no bandwidth authority votes on anything), doctor crashes with the following:

Traceback (most recent call last):
  File "./consensus_health_checker.py", line 746, in <module>
    main()
  File "./consensus_health_checker.py", line 243, in main
    issues += run_checks(consensuses, votes)
  File "./consensus_health_checker.py", line 325, in run_checks
    issues = checker(latest_consensus, consensuses, votes)
  File "./consensus_health_checker.py", line 678, in bandwidth_authorities_in_sync
    average = sum(measurement_counts.values()) / len(measurement_counts)
ZeroDivisionError: integer division or modulo by zero

Child Tickets

Change History (2)

comment:1 Changed 3 years ago by tom

Fixing this may be as simple as:

@@ -636,6 +675,9 @@ def bandwidth_authorities_in_sync(latest_consensus, consensuses, votes):
     if measured:
       measurement_counts[authority] = len(measured)

+  if not measurement_counts:
+    return
+
   average = sum(measurement_counts.values()) / len(measurement_counts)

   for authority, count in measurement_counts.items():

comment:2 Changed 3 years ago by atagar

  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.