Opened 6 years ago

Closed 6 years ago

#13390 closed defect (fixed)

If there are no bandwidth authorities, doctor crashes

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


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 "./", line 746, in <module>
  File "./", line 243, in main
    issues += run_checks(consensuses, votes)
  File "./", line 325, in run_checks
    issues = checker(latest_consensus, consensuses, votes)
  File "./", 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 6 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 6 years ago by atagar

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.