From b172270bcb57a0546057966e45b633bc4119cce4 Mon Sep 17 00:00:00 2001 From: Roger Dingledine Date: Tue, 25 Apr 2006 07:31:16 +0000 Subject: do some backporting. bug 285 is not yet backported. svn:r6423 --- src/or/cpuworker.c | 7 +++++-- src/or/hibernate.c | 5 +++-- src/or/main.c | 2 +- src/or/router.c | 11 ++++------- 4 files changed, 13 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/or/cpuworker.c b/src/or/cpuworker.c index 1e57c93316..badca3563e 100644 --- a/src/or/cpuworker.c +++ b/src/or/cpuworker.c @@ -396,8 +396,11 @@ process_pending_task(connection_t *cpuworker) log_warn(LD_OR,"assign_to_cpuworker failed. Ignoring."); } -/** How long do we let a cpuworker work before deciding that it's wedged? */ -#define CPUWORKER_BUSY_TIMEOUT (60*60) +/** How long should we let a cpuworker stay busy before we give + * up on it and decide that we have a bug or infinite loop? + * This value is high because some servers with low memory/cpu + * sometimes spend an hour or more swapping, and Tor starves. */ +#define CPUWORKER_BUSY_TIMEOUT (60*60*12) /** We have a bug that I can't find. Sometimes, very rarely, cpuworkers get * stuck in the 'busy' state, even though the cpuworker process thinks of diff --git a/src/or/hibernate.c b/src/or/hibernate.c index 1c734a96ea..da74e98dd2 100644 --- a/src/or/hibernate.c +++ b/src/or/hibernate.c @@ -862,9 +862,10 @@ consider_hibernation(time_t now) "Bandwidth soft limit reached; commencing hibernation."); hibernate_begin(HIBERNATE_STATE_LOWBANDWIDTH, now); } else if (accounting_enabled && now < interval_wakeup_time) { - format_iso_time(buf,interval_wakeup_time); + format_local_iso_time(buf,interval_wakeup_time); log_notice(LD_ACCT, - "Commencing hibernation. We will wake up at %s GMT", buf); + "Commencing hibernation. We will wake up at %s local time.", + buf); hibernate_go_dormant(now); } } diff --git a/src/or/main.c b/src/or/main.c index 47342ac389..fa65aad7ce 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -1349,7 +1349,7 @@ dumpstats(int severity) if (!connection_is_listener(conn)) { log(severity,LD_GENERAL, "Conn %d is to '%s:%d'.", i, - escaped_safe_str(conn->address), conn->port); + safe_str(conn->address), conn->port); log(severity,LD_GENERAL, "Conn %d: %d bytes waiting on inbuf (len %d, last read %d secs ago)", i, diff --git a/src/or/router.c b/src/or/router.c index 16174acdc7..7cd7255b67 100644 --- a/src/or/router.c +++ b/src/or/router.c @@ -760,10 +760,9 @@ router_get_my_routerinfo(void) if (!server_mode(get_options())) return NULL; - if (!desc_routerinfo) { - if (router_rebuild_descriptor(1)) + if (!desc_routerinfo || !desc_clean_since) + if (router_rebuild_descriptor(!desc_routerinfo)) return NULL; - } return desc_routerinfo; } @@ -774,10 +773,8 @@ const char * router_get_my_descriptor(void) { const char *body; - if (!desc_routerinfo) { - if (router_rebuild_descriptor(1)) - return NULL; - } + if (!router_get_my_routerinfo()) + return NULL; body = signed_descriptor_get_body(&desc_routerinfo->cache_info); log_debug(LD_GENERAL,"my desc is '%s'", body); return body; -- cgit v1.2.3-54-g00ecf