Commit bc14afe0 authored by Nick Mathewson's avatar Nick Mathewson 🎨
Browse files

r11872@Kushana: nickm | 2007-01-06 02:14:12 -0500

 Implement a control status event for bad libevent version/method combos.  Warn that libevent <1.1 with select() is needlessly slow.  Reply to comment.


svn:r9284
parent 03d6e981
...@@ -19,6 +19,9 @@ Changes in version 0.1.2.6-alpha - 2007-??-?? ...@@ -19,6 +19,9 @@ Changes in version 0.1.2.6-alpha - 2007-??-??
- Implement CHECKING_REACHABILITY and REACHABILITY_{SUCCEEDED|FAILED} - Implement CHECKING_REACHABILITY and REACHABILITY_{SUCCEEDED|FAILED}
server status events so controllers can learn about Tor's progress in server status events so controllers can learn about Tor's progress in
deciding whether it's reachable from the outside. deciding whether it's reachable from the outside.
- Implement BAD_LIBEVENT general status event so controllers can learn
when we have a version/method combination in libevent that needs to
be changed.
o Minor features (directory): o Minor features (directory):
- Authorities do not recommend exits as guards if this would shift - Authorities do not recommend exits as guards if this would shift
...@@ -30,6 +33,8 @@ Changes in version 0.1.2.6-alpha - 2007-??-?? ...@@ -30,6 +33,8 @@ Changes in version 0.1.2.6-alpha - 2007-??-??
- Prevent an (unlikely) bug on 32-bit architectures that could make - Prevent an (unlikely) bug on 32-bit architectures that could make
directories send 503s incorrectly when BandwidthBurst plus 2 times directories send 503s incorrectly when BandwidthBurst plus 2 times
BandwidthRate was over to 2 GB. BandwidthRate was over to 2 GB.
- Warn that using select() on any libevent version before 1.1 will be
unnecessarily slow (even for select()).
Changes in version 0.1.2.5-alpha - 2007-01-06 Changes in version 0.1.2.5-alpha - 2007-01-06
......
...@@ -1030,6 +1030,17 @@ do for each. -RD] ...@@ -1030,6 +1030,17 @@ do for each. -RD]
a NETWORKSTATUS, we decided we're skewed because we got a a NETWORKSTATUS, we decided we're skewed because we got a
networkstatus from far in the future. networkstatus from far in the future.
BAD_LIBEVENT
"METHOD=" libevent method
"VERSION=" libevent version
"BADNESS=" "BROKEN" / "BUGGY" / "SLOW"
"RECOVERED=" "NO" / "YES"
Tor knows about bugs in using the configured event method in this
version of libevent. "BROKEN" libevents won't work at all;
"BUGGY" libevents might work okay; "SLOW" libevents will work
fine, but not quickly. If "RECOVERED" is YES, Tor managed to
switch to a more reliable (but probably slower!) libevent method.
Actions for STATUS_GENERAL severity ERR events can be as follows: Actions for STATUS_GENERAL severity ERR events can be as follows:
BAD_PROXY BAD_PROXY
......
...@@ -577,7 +577,8 @@ static int opt_streq(const char *s1, const char *s2); ...@@ -577,7 +577,8 @@ static int opt_streq(const char *s1, const char *s2);
typedef enum { typedef enum {
/* Note: we compare these, so it's important that "old" precede everything, /* Note: we compare these, so it's important that "old" precede everything,
* and that "other" come last. */ * and that "other" come last. */
LE_OLD=0, LE_10C, LE_10D, LE_10E, LE_11, LE_11A, LE_11B, LE_12, LE_OTHER LE_OLD=0, LE_10C, LE_10D, LE_10E, LE_11, LE_11A, LE_11B, LE_12, LE_12A,
LE_OTHER
} le_version_t; } le_version_t;
static le_version_t decode_libevent_version(void); static le_version_t decode_libevent_version(void);
#if defined(HAVE_EVENT_GET_VERSION) && defined(HAVE_EVENT_GET_METHOD) #if defined(HAVE_EVENT_GET_VERSION) && defined(HAVE_EVENT_GET_METHOD)
...@@ -3783,6 +3784,7 @@ static const struct { ...@@ -3783,6 +3784,7 @@ static const struct {
{ "1.1a", LE_11A }, { "1.1a", LE_11A },
{ "1.1b", LE_11B }, { "1.1b", LE_11B },
{ "1.2", LE_12 }, { "1.2", LE_12 },
{ "1.2a", LE_12A },
{ NULL, LE_OTHER } { NULL, LE_OTHER }
}; };
...@@ -3810,6 +3812,7 @@ check_libevent_version(const char *m, int server) ...@@ -3810,6 +3812,7 @@ check_libevent_version(const char *m, int server)
int buggy = 0, iffy = 0, slow = 0; int buggy = 0, iffy = 0, slow = 0;
le_version_t version; le_version_t version;
const char *v = event_get_version(); const char *v = event_get_version();
const char *badness = NULL;
version = decode_libevent_version(); version = decode_libevent_version();
...@@ -3817,6 +3820,12 @@ check_libevent_version(const char *m, int server) ...@@ -3817,6 +3820,12 @@ check_libevent_version(const char *m, int server)
* are buggy, rather than just warning about them and then proceeding * are buggy, rather than just warning about them and then proceeding
* to use them? If so, we should probably not wrap this whole thing * to use them? If so, we should probably not wrap this whole thing
* in HAVE_EVENT_GET_VERSION and HAVE_EVENT_GET_METHOD. -RD */ * in HAVE_EVENT_GET_VERSION and HAVE_EVENT_GET_METHOD. -RD */
/* XXXX The problem is that it's not trivial to get libevent to change it's
* method once it's initialized, and it's not trivial to tell what method it
* will use without initializing it. I guess we could preemptively disable
* buggy libevent modes based on the version _before_ initializing it,
* though, but then there's no good way (afaict) to warn "I would have used
* kqueue, but instead I'm using select." -NM */
if (!strcmp(m, "kqueue")) { if (!strcmp(m, "kqueue")) {
if (version < LE_11B) if (version < LE_11B)
buggy = 1; buggy = 1;
...@@ -3828,7 +3837,7 @@ check_libevent_version(const char *m, int server) ...@@ -3828,7 +3837,7 @@ check_libevent_version(const char *m, int server)
buggy = 1; buggy = 1;
else if (version < LE_11) else if (version < LE_11)
slow = 1; slow = 1;
} else if (!strcmp(m, "poll")) { } else if (!strcmp(m, "select")) {
if (version < LE_11) if (version < LE_11)
slow = 1; slow = 1;
} else if (!strcmp(m, "win32")) { } else if (!strcmp(m, "win32")) {
...@@ -3840,15 +3849,23 @@ check_libevent_version(const char *m, int server) ...@@ -3840,15 +3849,23 @@ check_libevent_version(const char *m, int server)
log(LOG_WARN, LD_GENERAL, log(LOG_WARN, LD_GENERAL,
"There are known bugs in using %s with libevent %s. " "There are known bugs in using %s with libevent %s. "
"Please use the latest version of libevent.", m, v); "Please use the latest version of libevent.", m, v);
badness = "BROKEN";
} else if (iffy) { } else if (iffy) {
log(LOG_WARN, LD_GENERAL, log(LOG_WARN, LD_GENERAL,
"There are minor bugs in using %s with libevent %s. " "There are minor bugs in using %s with libevent %s. "
"You may want to use the latest version of libevent.", m, v); "You may want to use the latest version of libevent.", m, v);
badness = "BUGGY";
} else if (slow && server) { } else if (slow && server) {
log(LOG_WARN, LD_GENERAL, log(LOG_WARN, LD_GENERAL,
"libevent %s can be very slow with %s. " "libevent %s can be very slow with %s. "
"When running a server, please use the latest version of libevent.", "When running a server, please use the latest version of libevent.",
v,m); v,m);
badness = "SLOW";
}
if (badness) {
control_event_general_status(LOG_WARN,
"BAD_LIBEVENT VERSION=%s METHOD=%s BADNESS=%s RECOVERED=NO",
v, m, badness);
} }
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment