[tor-commits] [doctor/master] Avoid crashing when a vote is missing

atagar at torproject.org atagar at torproject.org
Tue May 9 16:52:03 UTC 2017


commit 8724b42d5dc51f2c5028de3b4c30aa46d9135bcd
Author: Damian Johnson <atagar at torproject.org>
Date:   Tue May 9 09:56:27 2017 -0700

    Avoid crashing when a vote is missing
    
    Addressing a simple stacktrace I see on occasion...
    
      Traceback (most recent call last):
        File "/srv/doctor.torproject.org/doctor/consensus_health_checker.py", line 885, in <module>
          main()
        File "/srv/doctor.torproject.org/doctor/consensus_health_checker.py", line 244, in main
          issues += run_checks(consensuses, votes)
        File "/srv/doctor.torproject.org/doctor/consensus_health_checker.py", line 336, in run_checks
          issues = checker(latest_consensus, consensuses, votes)
        File "/srv/doctor.torproject.org/doctor/consensus_health_checker.py", line 790, in shared_random_commit_partitioning
          if commitment.commit != self_commitments[commitment.identity]:
      KeyError: u'D586D18309DED4CD6D57C18FDB97EFA96D330566'
---
 consensus_health_checker.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/consensus_health_checker.py b/consensus_health_checker.py
index b88f534..9fa1dc7 100755
--- a/consensus_health_checker.py
+++ b/consensus_health_checker.py
@@ -787,7 +787,9 @@ def shared_random_commit_partitioning(latest_consensus, consensuses, votes):
 
   for authority, vote in votes.items():
     for commitment in vote.directory_authorities[0].shared_randomness_commitments:
-      if commitment.commit != self_commitments[commitment.identity]:
+      if commitment.identity not in self_commitments[commitment.identity:
+        pass  # we didn't get a vote for this authority so we don't know its self-reported commitment
+      elif commitment.commit != self_commitments[commitment.identity]:
         issues.append(Issue(Runlevel.WARNING, 'SHARED_RANDOM_COMMITMENT_MISMATCH', authority = authority, their_v3ident = commitment.identity, our_value = commitment.commit, their_value = self_commitments[commitment.identity], to = [authority]))
 
 def shared_random_reveal_partitioning(latest_consensus, consensuses, votes):



More information about the tor-commits mailing list