[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [sbws/master] Fix assertion if stem can't find a relay
commit 88fae60bc7b420ca7f36f92b482401b8a7adebaf
Author: Matt Traudt <sirmatt@xxxxxxx>
Date: Wed Jun 6 20:43:42 2018 -0400
Fix assertion if stem can't find a relay
2018-06-06 04:42:03 ERROR Thread-5 scanner.py:225 - dispatch_worker_thread - Unhandled exception in worker thread
Traceback (most recent call last):
File "/home/pastly/src/simple-bw-scanner/sbws/core/scanner.py", line 223, in dispatch_worker_thread
return measure_relay(*a, **kw)
File "/home/pastly/src/simple-bw-scanner/sbws/core/scanner.py", line 138, in measure_relay
dest = destinations.next()
File "/home/pastly/src/simple-bw-scanner/sbws/lib/destination.py", line 222, in next
self._perform_usability_test()
File "/home/pastly/src/simple-bw-scanner/sbws/lib/destination.py", line 171, in _perform_usability_test
circ_id = self._cb.build_circuit([None, exit.fingerprint])
File "/home/pastly/src/simple-bw-scanner/sbws/lib/circuitbuilder.py", line 175, in build_circuit
for r in path]
File "/home/pastly/src/simple-bw-scanner/sbws/lib/circuitbuilder.py", line 175, in <listcomp>
for r in path]
AttributeError: 'NoneType' object has no attribute 'fingerprint'
2018-06-06 04:42:03 ERROR Thread-10 scanner.py:280 - closure - Unhandled exception caught while measuring torbogen: <class 'AttributeError'> 'NoneType' object has no attribute 'fingerprint'
---
sbws/lib/circuitbuilder.py | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/sbws/lib/circuitbuilder.py b/sbws/lib/circuitbuilder.py
index d7dbe90..ac5603b 100644
--- a/sbws/lib/circuitbuilder.py
+++ b/sbws/lib/circuitbuilder.py
@@ -147,8 +147,20 @@ class GapsCircuitBuilder(CircuitBuilder):
continue
chosen_fps.append(choice)
black_fps.append(choice)
- return [stem_utils.fp_or_nick_to_relay(self.controller, fp)
- for fp in chosen_fps]
+ relays = []
+ for fp in chosen_fps:
+ relay = stem_utils.fp_or_nick_to_relay(self.controller, fp)
+ if not relay:
+ log.warning(
+ 'We\'re selecting a handful of random relays and stem '
+ 'doesn\'t think one of the fingerprints we gave it goes '
+ 'to a relay. Maybe we got a new consensus since the last '
+ 'time we refreshed our list of relays. In any case, we '
+ 'could try to recover. But failing inside '
+ '_random_sample_relays is easier. Sorry.')
+ return None
+ relays.append(relay)
+ return relays
def build_circuit(self, path):
''' <path> is a list of relays and Falsey values. Relays can be
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits