[tor-commits] [tor/maint-0.3.2] Fix another crash-on-no-threadpool bug.

nickm at torproject.org nickm at torproject.org
Tue Apr 24 12:52:13 UTC 2018


commit 386f8016b7373bec346162705671751f07f281d7
Author: Nick Mathewson <nickm at torproject.org>
Date:   Tue Apr 10 14:44:38 2018 -0400

    Fix another crash-on-no-threadpool bug.
    
    This one happens if for some reason you start with DirPort enabled
    but server mode turned off entirely.
    
    Fixes a case of bug 23693; bugfix on 0.3.1.1-alpha.
---
 changes/bug23693.1 |  4 ++++
 src/or/config.c    | 10 +++++++++-
 src/or/main.c      |  2 +-
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/changes/bug23693.1 b/changes/bug23693.1
new file mode 100644
index 000000000..4b1678881
--- /dev/null
+++ b/changes/bug23693.1
@@ -0,0 +1,4 @@
+  o Minor bugfixes (relay, crash):
+    - Avoid a crash when running with DirPort set but ORPort tuned off.
+      Fixes a case of bug 23693; bugfix on 0.3.1.1-alpha.
+
diff --git a/src/or/config.c b/src/or/config.c
index 156ffc9df..cac4ce812 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -1941,9 +1941,16 @@ options_act(const or_options_t *old_options)
     if (transition_affects_workers) {
       log_info(LD_GENERAL,
                "Worker-related options changed. Rotating workers.");
+      const int server_mode_turned_on =
+        server_mode(options) && !server_mode(old_options);
+      const int dir_server_mode_turned_on =
+        dir_server_mode(options) && !dir_server_mode(old_options);
 
-      if (server_mode(options) && !server_mode(old_options)) {
+      if (server_mode_turned_on || dir_server_mode_turned_on) {
         cpu_init();
+      }
+
+      if (server_mode_turned_on) {
         ip_address_changed(0);
         if (have_completed_a_circuit() || !any_predicted_circuits(time(NULL)))
           inform_testing_reachability();
@@ -4494,6 +4501,7 @@ options_transition_affects_workers(const or_options_t *old_options,
       old_options->SafeLogging_ != new_options->SafeLogging_ ||
       old_options->ClientOnly != new_options->ClientOnly ||
       server_mode(old_options) != server_mode(new_options) ||
+      dir_server_mode(old_options) != dir_server_mode(new_options) ||
       public_server_mode(old_options) != public_server_mode(new_options) ||
       !config_lines_eq(old_options->Logs, new_options->Logs) ||
       old_options->LogMessageDomains != new_options->LogMessageDomains)
diff --git a/src/or/main.c b/src/or/main.c
index 197dfd430..e9723cb0b 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -2487,7 +2487,7 @@ do_main_loop(void)
   now = time(NULL);
   directory_info_has_arrived(now, 1, 0);
 
-  if (server_mode(get_options())) {
+  if (server_mode(get_options()) || dir_server_mode(get_options())) {
     /* launch cpuworkers. Need to do this *after* we've read the onion key. */
     cpu_init();
   }





More information about the tor-commits mailing list