Opened 8 years ago

Closed 8 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:


Traceback (most recent call last):
  File "../../TorCtl/", line 720, in _eventLoop
    self._handleFn(timestamp, reply)
  File "../../TorCtl/", line 1346, in _handle1
    self._map1.get(event.event_name, self.unknown_event)(event)
  File "../../TorCtl/", line 1837, in new_consensus_event
    TorCtl.ConsensusTracker.new_consensus_event(self, n)
  File "../../TorCtl/", line 1694, in new_consensus_event
  File "../../TorCtl/", line 1653, in _read_routers
    ratio_r.sort(lambda x, y: cmp(float(,
  File "../../TorCtl/", line 1654, in <lambda>
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

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

Child Tickets

Change History (6)

comment:1 Changed 8 years ago by aagbsn

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

diff --git a/ b/
index 485a2d9..9bba58d 100755
--- a/
+++ b/
@@ -510,8 +510,9 @@ class Router:
   def get_unmeasured_bw(self):
     # if unmeasured, the ratio of should be 1.0
-    if self.unmeasured: return
-    else: return self.desc_bw
+    if self.unmeasured and > 0: return
+    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 8 years ago by aagbsn

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

comment:4 Changed 8 years ago by aagbsn

Status: newneeds_review

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

comment:5 Changed 8 years ago by arma

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

comment:6 Changed 8 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.