Opened 7 years ago

Closed 7 years ago

#8399 closed defect (fixed)

Torflow traceback: ZeroDivisionError: float division

Reported by: arma Owned by: aagbsn
Priority: Medium Milestone:
Component: Core Tor/Torflow Version:
Severity: Keywords:
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

Traceback (most recent call last):
  File "../../TorCtl/TorCtl.py", line 720, in _eventLoop
    self._handleFn(timestamp, reply)
  File "../../TorCtl/TorCtl.py", line 1346, in _handle1
    self._map1.get(event.event_name, self.unknown_event)(event)
  File "../../TorCtl/PathSupport.py", line 1837, in new_consensus_event
    TorCtl.ConsensusTracker.new_consensus_event(self, n)
  File "../../TorCtl/TorCtl.py", line 1694, in new_consensus_event
    self._read_routers(self.ns_map.values())
  File "../../TorCtl/TorCtl.py", line 1653, in _read_routers
    ratio_r.sort(lambda x, y: cmp(float(y.bw)/y.get_unmeasured_bw(),
  File "../../TorCtl/TorCtl.py", line 1654, in <lambda>
    float(x.bw)/x.get_unmeasured_bw()))
ZeroDivisionError: float division

Preceded by

WARN[Thu Feb 28 23:02:26 2013]:No event for: 650 NEWCONSENSUS

and post-ceded by

NOTICE[Thu Feb 28 23:02:26 2013]:Tor closed control connection. Exiting event thread.
WARN[Thu Feb 28 23:02:26 2013]:Child process recieved SIGTERM
INFO[Thu Feb 28 23:02:26 2013]:Beginning time loop
DEBUG[Thu Feb 28 23:02:27 2013]:Child Process Spawning...
INFO[Thu Feb 28 23:02:27 2013]:Connecting to Tor at 127.0.0.1:9111

so it looks like it took down something-er-other too.

Child Tickets

Change History (6)

comment:1 Changed 7 years ago by aagbsn

Just ran into this myself. I'm not sure why self.desc_bw or self.bw is ever 0, but perhaps a hack like:

diff --git a/TorCtl.py b/TorCtl.py
index 485a2d9..9bba58d 100755
--- a/TorCtl.py
+++ b/TorCtl.py
@@ -510,8 +510,9 @@ class Router:
 
   def get_unmeasured_bw(self):
     # if unmeasured, the ratio of self.bw/self.desc_bw should be 1.0
-    if self.unmeasured: return self.bw
-    else: return self.desc_bw
+    if self.unmeasured and self.bw > 0: return self.bw
+    elif self.desc_bw > 0: return self.desc_bw
+    else: return 1
    
 class Connection:
   """A Connection represents a connection to the Tor process via the 

would do the trick

comment:3 Changed 7 years ago by aagbsn

Fix above fixes the crashing, but it remains unknown why the bw value is ever 0.

comment:4 Changed 7 years ago by aagbsn

Status: newneeds_review

Seems to work on my system stably over the last 6 days. Thoughts?

comment:5 Changed 7 years ago by arma

Merge it! Unless you're waiting for Mike to look at it.

comment:6 Changed 7 years ago by aagbsn

Resolution: fixed
Status: needs_reviewclosed

Merged, but my concern was that we shouldn't ever get a 0 bw value, right?

Note: See TracTickets for help on using tickets.