[tor-bugs] #26412 [Core Tor/Stem]: KeyError in can_exit_to caused by lru_cache

Tor Bug Tracker & Wiki blackhole at torproject.org
Tue Jul 10 14:53:56 UTC 2018


#26412: KeyError in can_exit_to caused by lru_cache
---------------------------+------------------------
 Reporter:  juga           |          Owner:  atagar
     Type:  defect         |         Status:  new
 Priority:  Medium         |      Milestone:
Component:  Core Tor/Stem  |        Version:
 Severity:  Normal         |     Resolution:
 Keywords:  tor-bwauth     |  Actual Points:
Parent ID:                 |         Points:
 Reviewer:                 |        Sponsor:
---------------------------+------------------------
Changes (by pastly):

 * status:  needs_information => new


Comment:

 sbws version 0.4.0
 stem version 1.6.0-dev at 0192b29a4784465e5f69f11ced584a54644e4a90

 See below for tested versions.
 {{{
 matt at play:~/src$ grep -c KeyError dotsbws-3*/debug.scanner.log
 dotsbws-345/debug.scanner.log:0
 dotsbws-346/debug.scanner.log:0
 dotsbws-347/debug.scanner.log:0
 dotsbws-348/debug.scanner.log:0
 dotsbws-350/debug.scanner.log:228
 dotsbws-351/debug.scanner.log:8175308
 dotsbws-352/debug.scanner.log:234
 dotsbws-353/debug.scanner.log:69750
 dotsbws-354/debug.scanner.log:0
 dotsbws-362/debug.scanner.log:0
 dotsbws-363/debug.scanner.log:0
 dotsbws-364/debug.scanner.log:0
 dotsbws-365/debug.scanner.log:0
 }}}


 The huge difference in the numbers is because I ran these for vastly
 different amounts of time. 3.5.1 is not 3 orders of magnitude more buggy
 than 3.5.0. 3.5.4 ran for 24 hours and didn't display the issue; 3.5.0 ran
 for 2 minutes and displayed the issue.

 Example unhelpful traceback that the above grep is searching for.

 {{{
 [2018-07-10 10:42:47,961] [sbws.lib.relaylist] [ERROR] Got that KeyError
 in stem again...: (<stem.exit_policy.ExitPolicy object at 0x7f9fe6f656d8>,
 <object object at 0x7fa01e24b080>, ('port', 80))
 Traceback (most recent call last):
   File "/home/matt/src/simple-bw-scanner/sbws/lib/relaylist.py", line 167,
 in exits_can_exit_to
     if policy is not None and policy.can_exit_to(port=port):
 }}}

 atagar: based on these findings I recommend using stem's lru_cache for
 python 3.5.0-3.5.3. Or ... figuring out why getting exit policies from
 microdescriptors doesn't play nicely with python's lru_cache in only a
 couple versions of python.

 Switching back to new because I no longer think this needs_information.

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/26412#comment:5>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list