[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [doctor/master] Only give BadExit sync notification if relay is in the consensus



commit 2db42c80d42bf6e1c4f2ea745e4d157bb230070e
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Thu Mar 24 07:34:15 2016 -0700

    Only give BadExit sync notification if relay is in the consensus
    
    We suppressed this check if the relay was new and not in votes, but guess
    that's not enough. Changed this to check if the relay's in the latest overall
    consensus instead.
---
 consensus_health_checker.py | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/consensus_health_checker.py b/consensus_health_checker.py
index d122c27..c521e64 100755
--- a/consensus_health_checker.py
+++ b/consensus_health_checker.py
@@ -663,7 +663,7 @@ def bad_exits_in_sync(latest_consensus, consensuses, votes):
   for fingerprint in disagreed_bad_exits:
     with_flag = set([authority for authority, flagged in bad_exits.items() if fingerprint in flagged])
     without_flag = []
-    not_in_consensus = []
+    not_in_vote = []
 
     for authority in voting_authorities.difference(with_flag):
       vote = votes[authority]
@@ -671,16 +671,13 @@ def bad_exits_in_sync(latest_consensus, consensuses, votes):
       if fingerprint in vote.routers:
         without_flag.append(authority)
       else:
-        not_in_consensus.append(authority)
+        not_in_vote.append(authority)
 
-    # If this relay's missing from a consensus and has been active for less
-    # than an hour then don't bother. It gets negligable traffic and is likely
-    # part of normal network churn.
+    # If this relay's missing from a consensus then don't bother. It gets
+    # negligable traffic and is likely part of normal network churn.
 
-    desc = votes[list(with_flag)[0]].routers[fingerprint]
-    uptime = (datetime.datetime.now() - desc.published).total_seconds()
-
-    if not_in_consensus and uptime < 3600:
+    if fingerprint not in latest_consensus.routers:
+      log.debug("BadExit sync check is skipping %s because it's not in the latest consensus" % fingerprint)
       continue
 
     attr = ['with flag: %s' % ', '.join(with_flag)]
@@ -688,8 +685,8 @@ def bad_exits_in_sync(latest_consensus, consensuses, votes):
     if without_flag:
       attr.append('without flag: %s' % ', '.join(without_flag))
 
-    if not_in_consensus:
-      attr.append('not in consensus: %s' % ', '.join(not_in_consensus))
+    if not_in_vote:
+      attr.append('not in consensus: %s' % ', '.join(not_in_vote))
 
     issues.append(Issue(Runlevel.NOTICE, 'BADEXIT_OUT_OF_SYNC', fingerprint = fingerprint, counts = ', '.join(attr), to = bad_exits.keys()))
 

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits