[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [bridgedb/master] Catch DescriptorWarnings and log them when we get identical descriptors.
commit a27d79055d7b8de22a069c6ab8ee6ce2ffcd459a
Author: Isis Lovecruft <isis@xxxxxxxxxxxxxx>
Date: Sat Mar 21 03:31:06 2015 +0000
Catch DescriptorWarnings and log them when we get identical descriptors.
It turns out this actually does happen. Not very many times, though.
When redeploying BridgeDB-0.3.0 with the new Stem descriptor parsers
from #9380, [0] there were two bridges who had completely identical
descriptor (including identical timestamps). Each of those bridges had
exactly one perfectly identical duplicate descriptor each, and each
bridge was quite new, having just appeared within the last 8 hours.
Previously, the BridgeDB process would die because we didn't catch these
errors. This fixes that.
[0]: https://bugs.torproject.org/9380
---
lib/bridgedb/parse/descriptors.py | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/lib/bridgedb/parse/descriptors.py b/lib/bridgedb/parse/descriptors.py
index 80063ca..409a200 100644
--- a/lib/bridgedb/parse/descriptors.py
+++ b/lib/bridgedb/parse/descriptors.py
@@ -198,10 +198,14 @@ def deduplicate(descriptors):
# ``platform`` line in its server-descriptor and tell whoever
# wrote that code that they're probably (D)DOSing the Tor network.
else:
- raise DescriptorWarning(
- ("Duplicate descriptor with identical timestamp (%s) for "
- "router with fingerprint '%s'!")
- % (descriptor.published, fingerprint))
+ try:
+ raise DescriptorWarning(
+ ("Duplicate descriptor with identical timestamp (%s) "
+ "for router with fingerprint '%s'!")
+ % (descriptor.published, fingerprint))
+ # And just in case it does happen, catch the warning:
+ except DescriptorWarning as descwarn:
+ logging.warn("DescriptorWarning: %s" % str(descwarn))
# Hoorah! No duplicates! (yet...)
else:
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits