[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [tor-bugs] #33420 [Metrics/Onionperf]: Add CBT events to Onionperf result files



#33420: Add CBT events to Onionperf result files
-------------------------------------------------+-------------------------
 Reporter:  acute                                |          Owner:
                                                 |  metrics-team
     Type:  enhancement                          |         Status:
                                                 |  assigned
 Priority:  Medium                               |      Milestone:
Component:  Metrics/Onionperf                    |        Version:
 Severity:  Normal                               |     Resolution:
 Keywords:  metrics-team-roadmap-2020, metrics-  |  Actual Points:  0.3
  team-roadmap-2020-june                         |
Parent ID:  #33321                               |         Points:  2.0
 Reviewer:                                       |        Sponsor:
                                                 |  Sponsor59-must
-------------------------------------------------+-------------------------
Changes (by karsten):

 * owner:  karsten => metrics-team
 * status:  needs_information => assigned


Comment:

 I briefly ran mikeperry's patch and want to share my experience here.

 I had to patch the branch by calling the relevant functions as part of
 dropping guards. The only reason was that Stem (obviously) doesn't have a
 `drop_timeouts()` function yet. Here's my patch on top of mikeperry's
 branch:

 {{{
 diff --git a/src/feature/control/control_cmd.c
 b/src/feature/control/control_cmd.c
 index 74d542ec6d..3cd586ccff 100644
 --- a/src/feature/control/control_cmd.c
 +++ b/src/feature/control/control_cmd.c
 @@ -1393,8 +1393,12 @@ handle_control_dropguards(control_connection_t
 *conn,
    }

    remove_all_entry_guards();
 +  circuit_build_times_reset(get_circuit_build_times_mutable());
    send_control_done(conn);

 +  cbt_control_event_buildtimeout_set(get_circuit_build_times(),
 +                                     BUILDTIMEOUT_SET_EVENT_RESET);
 +
    return 0;
  }

 }}}

 I then patched OnionPerf to:
  - use entry guards (which isn't technically required for this branch, but
 I did this when working on #33399),
  - increase the `NEWNYM` interval from 5 minutes to 1 hour and drop guards
 and timeouts right after sending the `NEWNYM` command (even though this
 could have happened separately with `NEWNYM` being sent every 5 minutes
 and the two drop commands happening once per hour), and
  - distinguish `BUILDTIMEOUT_SET COMPUTED` events from other
 `BUILDTIMEOUT_SET` events.

 Here's my patch:

 {{{
 diff --git a/onionperf/analysis.py b/onionperf/analysis.py
 index 20ca354..7913adc 100644
 --- a/onionperf/analysis.py
 +++ b/onionperf/analysis.py
 @@ -12,7 +12,7 @@ from socket import gethostname
  from abc import ABCMeta, abstractmethod

  # stem imports
 -from stem import CircEvent, CircStatus, CircPurpose, StreamStatus
 +from stem import CircEvent, CircStatus, CircPurpose, StreamStatus,
 TimeoutSetType
  from stem.response.events import CircuitEvent, CircMinorEvent,
 StreamEvent, BandwidthEvent, BuildTimeoutSetEvent
  from stem.response import ControlMessage, convert

 @@ -630,8 +630,12 @@ class TorCtlParser(Parser):
          self.bandwidth_summary['bytes_written'][int(arrival_dt)] =
 event.written

      def __handle_buildtimeout(self, event, arrival_dt):
 -        self.build_timeout_last = event.timeout
 -        self.build_quantile_last = event.quantile
 +        if event.set_type == TimeoutSetType.COMPUTED:
 +            self.build_timeout_last = event.timeout
 +            self.build_quantile_last = event.quantile
 +        else:
 +            self.build_timeout_last = None
 +            self.build_quantile_last = None

      def __handle_event(self, event, arrival_dt):
          if isinstance(event, (CircuitEvent, CircMinorEvent)):
 diff --git a/onionperf/measurement.py b/onionperf/measurement.py
 index 4a58bc4..c8fc9f8 100644
 --- a/onionperf/measurement.py
 +++ b/onionperf/measurement.py
 @@ -388,8 +388,8 @@ WarnUnsafeSocks 0\nSafeLogging 0\nMaxCircuitDirtiness
 60 seconds\nDataDirectory
                  tor_config = tor_config + f.read()
          if name == "client" and self.additional_client_conf:
              tor_config += self.additional_client_conf
 -        if not 'UseEntryGuards' in tor_config and not 'UseBridges' in
 tor_config:
 -            tor_config += "UseEntryGuards 0\n"
 +        #if not 'UseEntryGuards' in tor_config and not 'UseBridges' in
 tor_config:
 +            #tor_config += "UseEntryGuards 0\n"
          if name == "server" and self.single_onion:
              tor_config += "HiddenServiceSingleHopMode
 1\nHiddenServiceNonAnonymousMode 1\n"
          return tor_config
 @@ -466,7 +466,7 @@ WarnUnsafeSocks 0\nSafeLogging 0\nMaxCircuitDirtiness
 60 seconds\nDataDirectory
          time.sleep(3)

          torctl_events = [e for e in monitor.get_supported_torctl_events()
 if e not in ['DEBUG', 'INFO', 'NOTICE', 'WARN', 'ERR']]
 -        newnym_interval_seconds = 300
 +        newnym_interval_seconds = 3600
          torctl_args = (control_port, torctl_writable, torctl_events,
 newnym_interval_seconds, self.done_event)
          torctl_helper = threading.Thread(target=monitor.tor_monitor_run,
 name="torctl_{0}_helper".format(name), args=torctl_args)
          torctl_helper.start()
 diff --git a/onionperf/monitor.py b/onionperf/monitor.py
 index 5387bff..074876e 100644
 --- a/onionperf/monitor.py
 +++ b/onionperf/monitor.py
 @@ -64,6 +64,7 @@ class TorMonitor(object):
                      if newnym_interval_seconds is not None and
 interval_count >= newnym_interval_seconds:
                          interval_count = 0
                          torctl.signal(Signal.NEWNYM)
 +                        torctl.drop_guards()
              except KeyboardInterrupt:
                  pass  # the user hit ctrl+c

 }}}

 I'm attaching the OnionPerf analysis file from running this branch for a
 couple hours. When you grep for `"build"`, you'll find that there
 alternating batches of circuits having `"build_quantile"` and
 `"build_timeout"` fields followed by batches of circuits without these two
 fields. In the latter case there was no build timeout set.

 Reassigning to metrics-team, so that others can look into mikeperry's
 patch and also think about remaining steps here. This ticket is far from
 being done.

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/33420#comment:12>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs