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

[or-cvs] r10309: Backport 10307: Warn when using a version of libevent before (in tor/branches/tor-0_1_2-patches: . src/or)



Author: nickm
Date: 2007-05-24 13:23:10 -0400 (Thu, 24 May 2007)
New Revision: 10309

Modified:
   tor/branches/tor-0_1_2-patches/
   tor/branches/tor-0_1_2-patches/ChangeLog
   tor/branches/tor-0_1_2-patches/src/or/config.c
Log:
 r12928@catbus:  nickm | 2007-05-24 13:23:07 -0400
 Backport 10307: Warn when using a version of libevent before 1.3b to run a server on osx or bsd: these versions of libevent interact badly with userspace threads.



Property changes on: tor/branches/tor-0_1_2-patches
___________________________________________________________________
 svk:merge ticket from /tor/012 [r12928] on 8246c3cf-6607-4228-993b-4d95d33730f1

Modified: tor/branches/tor-0_1_2-patches/ChangeLog
===================================================================
--- tor/branches/tor-0_1_2-patches/ChangeLog	2007-05-24 17:13:08 UTC (rev 10308)
+++ tor/branches/tor-0_1_2-patches/ChangeLog	2007-05-24 17:23:10 UTC (rev 10309)
@@ -41,6 +41,8 @@
     - When routers publish SVN revisions in their router descriptors,
       authorities now include those versions correctly in networkstatus
       documents.
+    - Warn when using a version of libevent before 1.3b to run a server on
+      OSX or BSD: these versions interact badly with userspace threads.
 
 
 Changes in version 0.1.2.13 - 2007-04-24

Modified: tor/branches/tor-0_1_2-patches/src/or/config.c
===================================================================
--- tor/branches/tor-0_1_2-patches/src/or/config.c	2007-05-24 17:13:08 UTC (rev 10308)
+++ tor/branches/tor-0_1_2-patches/src/or/config.c	2007-05-24 17:23:10 UTC (rev 10309)
@@ -584,7 +584,7 @@
   /* Note: we compare these, so it's important that "old" precede everything,
    * and that "other" come last. */
   LE_OLD=0, LE_10C, LE_10D, LE_10E, LE_11, LE_11A, LE_11B, LE_12, LE_12A,
-  LE_13, LE_13A,
+  LE_13, LE_13A, LE_13B,
   LE_OTHER
 } le_version_t;
 static le_version_t decode_libevent_version(void);
@@ -3832,6 +3832,7 @@
   { "1.2a", LE_12A },
   { "1.3",  LE_13 },
   { "1.3a", LE_13A },
+  { "1.3b", LE_13B },
   { NULL, LE_OTHER }
 };
 
@@ -3858,10 +3859,11 @@
 static void
 check_libevent_version(const char *m, int server)
 {
-  int buggy = 0, iffy = 0, slow = 0;
+  int buggy = 0, iffy = 0, slow = 0, thread_unsafe = 0;
   le_version_t version;
   const char *v = event_get_version();
   const char *badness = NULL;
+  const char *sad_os = "";
 
   version = decode_libevent_version();
 
@@ -3894,8 +3896,27 @@
       buggy = 1;
   }
 
-  if (buggy) {
+  /* Libevent versions before 1.3b do very badly on operating systems with
+   * user-space threading implementations. */
+#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__)
+  if (server && version < LE_13B) {
+    thread_unsafe = 1;
+    sad_os = "BSD variants"
+      }
+#elif defined(__APPLE__) || defined(__darwin__)
+  if (server && version < LE_13B) {
+    thread_unsafe = 1;
+    sad_os = "Mac OS X";
+  }
+#endif
+
+  if (thread_unsafe) {
     log(LOG_WARN, LD_GENERAL,
+        "Libevent version %s often crashes when running a Tor server with %s. "
+        "Please use the latest version of libevent (1.3b or later)",v,sad_os);
+    badness = "BROKEN";
+  } else if (buggy) {
+    log(LOG_WARN, LD_GENERAL,
         "There are known bugs in using %s with libevent %s. "
         "Please use the latest version of libevent.", m, v);
     badness = "BROKEN";
@@ -3911,9 +3932,6 @@
         v,m);
     badness = "SLOW";
   }
-  /* XXXX012 if libevent 1.3b comes out before 0.1.2.x, and it works,
-   * recomment an upgrade to everybody on BSD or OSX or anywhere with
-   * that flavor of pthreads. */
   if (badness) {
     control_event_general_status(LOG_WARN,
         "BAD_LIBEVENT VERSION=%s METHOD=%s BADNESS=%s RECOVERED=NO",