[tor-commits] [stem/master] Avoid infinite recursion from new is_geoip_unavailable check

atagar at torproject.org atagar at torproject.org
Mon Aug 14 17:37:37 UTC 2017


commit f2305304084c62016b030064b97e43388d5af57a
Author: Damian Johnson <atagar at torproject.org>
Date:   Mon Aug 14 10:36:40 2017 -0700

    Avoid infinite recursion from new is_geoip_unavailable check
    
    Um... oops.
    
      /nyx/stem/control.py", line 469, in wrapped
        return func(self, *args, **kwargs)
      File "/home/ubuntu/nyx/stem/control.py", line 1147, in get_info
        if param.startswith('ip-to-country/') and self.is_geoip_unavailable():
      File "/home/ubuntu/nyx/stem/control.py", line 3661, in is_geoip_unavailable
        self.get_info('ip-to-country/0.0.0.0')
      File "/home/ubuntu/nyx/stem/control.py", line 469, in wrapped
        return func(self, *args, **kwargs)
      File "/home/ubuntu/nyx/stem/control.py", line 1147, in get_info
        if param.startswith('ip-to-country/') and self.is_geoip_unavailable():
      File "/home/ubuntu/nyx/stem/control.py", line 3661, in is_geoip_unavailable
        self.get_info('ip-to-country/0.0.0.0')
      File "/home/ubuntu/nyx/stem/control.py", line 469, in wrapped
        return func(self, *args, **kwargs)
      File "/home/ubuntu/nyx/stem/control.py", line 1139, in get_info
        cached_results = self._get_cache_map(from_cache, 'getinfo')
      File "/home/ubuntu/nyx/stem/control.py", line 3064, in _get_cache_map
        with self._cache_lock:
      File "/usr/lib/python2.7/threading.py", line 169, in acquire
        if self.__owner == me:
      RuntimeError: maximum recursion depth exceeded in cmp
---
 stem/control.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/stem/control.py b/stem/control.py
index 760f9433..7dc632bb 100644
--- a/stem/control.py
+++ b/stem/control.py
@@ -1144,7 +1144,7 @@ class Controller(BaseController):
       params.remove(user_expected_key)
 
     for param in params:
-      if param.startswith('ip-to-country/') and self.is_geoip_unavailable():
+      if param.startswith('ip-to-country/') and param != 'ip-to-country/0.0.0.0' and self.is_geoip_unavailable():
         raise stem.ProtocolError('Tor geoip database is unavailable')
 
     # if everything was cached then short circuit making the query



More information about the tor-commits mailing list