Re: [tor-bugs] #20467 [Metrics/Torflow]: bwauth aggregator divides by zero if a node class is missing

2017-03-15 Thread Tor Bug Tracker & Wiki
#20467: bwauth aggregator divides by zero if a node class is missing
-+
 Reporter:  teor |  Owner:  aagbsn
 Type:  defect   | Status:  closed
 Priority:  Medium   |  Milestone:
Component:  Metrics/Torflow  |Version:
 Severity:  Normal   | Resolution:  fixed
 Keywords:   |  Actual Points:
Parent ID:   | Points:
 Reviewer:   |Sponsor:
-+
Changes (by tom):

 * status:  needs_review => closed
 * resolution:   => fixed


Comment:

 Merged

--
Ticket URL: 
Tor Bug Tracker & Wiki 
The Tor Project: anonymity online
___
tor-bugs mailing list
tor-bugs@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs

Re: [tor-bugs] #20467 [Metrics/Torflow]: bwauth aggregator divides by zero if a node class is missing

2017-03-09 Thread Tor Bug Tracker & Wiki
#20467: bwauth aggregator divides by zero if a node class is missing
-+--
 Reporter:  teor |  Owner:  aagbsn
 Type:  defect   | Status:  needs_review
 Priority:  Medium   |  Milestone:
Component:  Metrics/Torflow  |Version:
 Severity:  Normal   | Resolution:
 Keywords:   |  Actual Points:
Parent ID:   | Points:
 Reviewer:   |Sponsor:
-+--

Comment (by tom):

 This is testing.

--
Ticket URL: 
Tor Bug Tracker & Wiki 
The Tor Project: anonymity online
___
tor-bugs mailing list
tor-bugs@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs

Re: [tor-bugs] #20467 [Metrics/Torflow]: bwauth aggregator divides by zero if a node class is missing

2016-11-04 Thread Tor Bug Tracker & Wiki
#20467: bwauth aggregator divides by zero if a node class is missing
-+--
 Reporter:  teor |  Owner:  aagbsn
 Type:  defect   | Status:  needs_review
 Priority:  Medium   |  Milestone:
Component:  Metrics/Torflow  |Version:
 Severity:  Normal   | Resolution:
 Keywords:   |  Actual Points:
Parent ID:   | Points:
 Reviewer:   |Sponsor:
-+--
Changes (by teor):

 * status:  new => needs_review


--
Ticket URL: 
Tor Bug Tracker & Wiki 
The Tor Project: anonymity online
___
tor-bugs mailing list
tor-bugs@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs

[tor-bugs] #20467 [Metrics/Torflow]: bwauth aggregator divides by zero if a node class is missing

2016-10-25 Thread Tor Bug Tracker & Wiki
#20467: bwauth aggregator divides by zero if a node class is missing
-+
 Reporter:  teor |  Owner:  aagbsn
 Type:  defect   | Status:  new
 Priority:  Medium   |  Milestone:
Component:  Metrics/Torflow  |Version:
 Severity:  Normal   |   Keywords:
Actual Points:   |  Parent ID:
   Points:   |   Reviewer:
  Sponsor:   |
-+
 The bwauth code expects there to always be a non-zero number of each of
 "Guard+Exit", "Guard", "Exit", and "Middle" nodes.

 In small networks, this isn't always the case:
 {{{
 diff --git a/NetworkScanners/BwAuthority/aggregate.py
 b/NetworkScanners/BwAuthority/aggregate.py
 index 01ea8b5..cae436b 100755
 --- a/NetworkScanners/BwAuthority/aggregate.py
 +++ b/NetworkScanners/BwAuthority/aggregate.py
 @@ -489,10 +489,15 @@ def main(argv):

  for cl in ["Guard+Exit", "Guard", "Exit", "Middle"]:
c_nodes = filter(lambda n: n.node_class() == cl,
 nodes.itervalues())
 -  true_filt_avg[cl] = sum(map(lambda n: n.filt_bw,
 c_nodes))/float(len(c_nodes))
 -  true_strm_avg[cl] = sum(map(lambda n: n.strm_bw,
 c_nodes))/float(len(c_nodes))
 -  true_circ_avg[cl] = sum(map(lambda n: (1.0-n.circ_fail_rate),
 +  if len(c_nodes) > 0:
 +true_filt_avg[cl] = sum(map(lambda n: n.filt_bw,
 c_nodes))/float(len(c_nodes))
 +true_strm_avg[cl] = sum(map(lambda n: n.strm_bw,
 c_nodes))/float(len(c_nodes))
 +true_circ_avg[cl] = sum(map(lambda n: (1.0-n.circ_fail_rate),
   c_nodes))/float(len(c_nodes))
 +  else:
 +true_filt_avg[cl] = 0.0
 +true_strm_avg[cl] = 0.0
 +true_circ_avg[cl] = 0.0

# FIXME: This may be expensive
pid_tgt_avg[cl] = true_filt_avg[cl]
 @@ -835,10 +840,13 @@ def main(argv):
  c_nodes = filter(lambda n: n.node_class() == cl, nodes.itervalues())
  nc_nodes = filter(lambda n: n.pid_error < 0, c_nodes)
  pc_nodes = filter(lambda n: n.pid_error > 0, c_nodes)
 -plog("INFO", "Avg "+cl+"  pid_error="+str(sum(map(lambda n:
 n.pid_error, c_nodes))/len(c_nodes)))
 -plog("INFO", "Avg "+cl+" |pid_error|="+str(sum(map(lambda n:
 abs(n.pid_error), c_nodes))/len(c_nodes)))
 -plog("INFO", "Avg "+cl+" +pid_error=+"+str(sum(map(lambda n:
 n.pid_error, pc_nodes))/len(pc_nodes)))
 -plog("INFO", "Avg "+cl+" -pid_error="+str(sum(map(lambda n:
 n.pid_error, nc_nodes))/len(nc_nodes)))
 +if len(c_nodes) > 0:
 +  plog("INFO", "Avg "+cl+"  pid_error="+str(sum(map(lambda n:
 n.pid_error, c_nodes))/len(c_nodes)))
 +  plog("INFO", "Avg "+cl+" |pid_error|="+str(sum(map(lambda n:
 abs(n.pid_error), c_nodes))/len(c_nodes)))
 +if len(pc_nodes) > 0:
 +  plog("INFO", "Avg "+cl+" +pid_error=+"+str(sum(map(lambda n:
 n.pid_error, pc_nodes))/len(pc_nodes)))
 +if len(nc_nodes) > 0:
 +  plog("INFO", "Avg "+cl+" -pid_error="+str(sum(map(lambda n:
 n.pid_error, nc_nodes))/len(nc_nodes)))

n_nodes = filter(lambda n: n.pid_error < 0, nodes.itervalues())
p_nodes = filter(lambda n: n.pid_error > 0, nodes.itervalues())
 }}}

 We could fix this by guarding every division by a length with a check.
 Refactoring would make this much easier.

--
Ticket URL: 
Tor Bug Tracker & Wiki 
The Tor Project: anonymity online
___
tor-bugs mailing list
tor-bugs@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs