Opened 4 years ago

Closed 4 years ago

#13663 closed defect (fixed)

silent failure when scan-data directories don't exist

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

Description

I ran the bwauthority scripts for several days and watched it pull files and write to log files and wonder why the aggregation wasn't getting any nodes at all.

Eventually, tired of waiting with no clue, I took a dive into the code and found that it was wanting to write to the out_dir configured directory in each scanner.*/bwauthority.cfg, and I didn't have that directory. I'm surprised that things just kept going without an error, but I was more surprised that this wasn't handled in the code.

I think something like the following would be a trivial change to make this not be a problem for people in the future:

diff --git a/NetworkScanners/BwAuthority/bwauthority_child.py b/NetworkScanners/BwAuthority/bwauthority_child.py
index 28b89c2..296662a 100755
--- a/NetworkScanners/BwAuthority/bwauthority_child.py
+++ b/NetworkScanners/BwAuthority/bwauthority_child.py 
 
 # Do NOT modify this object directly after it is handed to PathBuilder
@@ -210,6 +210,12 @@ def speedrace(hdlr, start_pct, stop_pct, circs_per_node, save_every, out_dir,
 
   attempt = 0
   successful = 0
+
+  # make sure necessary out_dir directory exists
+  dir = os.getcwd()+'/'+out_dir
+  if not os.path.exists(dir):
+    os.makedirs(dir)
+
   while True:
     if hdlr.is_count_met(circs_per_node, successful): break
     hdlr.wait_for_consensus()

Child Tickets

Change History (2)

comment:1 Changed 4 years ago by aagbsn

The git repository includes the 'scan-data' directories in the tree, did somehow yours get removed?
I added this fix in https://gitweb.torproject.org/torflow.git/commit/666689ad18d358d764a35d041a7b16adb8d3287c
Thanks!

comment:2 Changed 4 years ago by aagbsn

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.