aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2014-05-07 22:52:44 -0400
committerNick Mathewson <nickm@torproject.org>2014-05-07 22:52:44 -0400
commit683b80bf815814f8c13f627aadc92267d009693e (patch)
tree72259035c0456f0d341e6c53b7548943df2635d5
parentc948bdaa2859bb4d92b8af526bf1363a854919e8 (diff)
parenta06044a485982bd91e380e71f3c5dc449782e75f (diff)
downloadtor-683b80bf815814f8c13f627aadc92267d009693e.tar
tor-683b80bf815814f8c13f627aadc92267d009693e.tar.gz
Merge remote-tracking branch 'public/bug11737_diagnostic'
-rw-r--r--changes/bug11737_diagnostic5
-rw-r--r--src/or/microdesc.c18
2 files changed, 17 insertions, 6 deletions
diff --git a/changes/bug11737_diagnostic b/changes/bug11737_diagnostic
new file mode 100644
index 000000000..62e7a4a78
--- /dev/null
+++ b/changes/bug11737_diagnostic
@@ -0,0 +1,5 @@
+ o Minor features (diagnostic):
+ - When logging a warning because of bug #7164, additionally check the
+ hash table for consistency (as proposed on ticket #11737). This may
+ help diagnose bug #7164.
+
diff --git a/src/or/microdesc.c b/src/or/microdesc.c
index ec85de0d6..fdb549a9a 100644
--- a/src/or/microdesc.c
+++ b/src/or/microdesc.c
@@ -386,18 +386,21 @@ microdesc_cache_clean(microdesc_cache_t *cache, time_t cutoff, int force)
smartlist_t *nodes = nodelist_find_nodes_with_microdesc(*mdp);
const networkstatus_t *ns = networkstatus_get_latest_consensus();
long networkstatus_age = -1;
+ const int ht_badness = HT_REP_IS_BAD_(microdesc_map, &cache->map);
if (ns) {
networkstatus_age = now - ns->valid_after;
}
log_warn(LD_BUG, "Microdescriptor seemed very old "
"(last listed %d hours ago vs %d hour cutoff), but is still "
"marked as being held by %d node(s). I found %d node(s) "
- "holding it. Current networkstatus is %ld hours old.",
+ "holding it. Current networkstatus is %ld hours old. "
+ "Hashtable badness is %d.",
(int)((now - (*mdp)->last_listed) / 3600),
(int)((now - cutoff) / 3600),
held_by_nodes,
smartlist_len(nodes),
- networkstatus_age / 3600);
+ networkstatus_age / 3600,
+ ht_badness);
SMARTLIST_FOREACH_BEGIN(nodes, const node_t *, node) {
const char *rs_match = "No RS";
@@ -664,8 +667,10 @@ microdesc_free_(microdesc_t *md, const char *fname, int lineno)
tor_fragile_assert();
}
if (md->held_by_nodes) {
+ microdesc_cache_t *cache = get_microdesc_cache();
int found=0;
const smartlist_t *nodes = nodelist_get_list();
+ const int ht_badness = HT_REP_IS_BAD_(microdesc_map, &cache->map);
SMARTLIST_FOREACH(nodes, node_t *, node, {
if (node->md == md) {
++found;
@@ -674,12 +679,13 @@ microdesc_free_(microdesc_t *md, const char *fname, int lineno)
});
if (found) {
log_warn(LD_BUG, "microdesc_free() called from %s:%d, but md was still "
- "referenced %d node(s); held_by_nodes == %u",
- fname, lineno, found, md->held_by_nodes);
+ "referenced %d node(s); held_by_nodes == %u, ht_badness == %d",
+ fname, lineno, found, md->held_by_nodes, ht_badness);
} else {
log_warn(LD_BUG, "microdesc_free() called from %s:%d with held_by_nodes "
- "set to %u, but md was not referenced by any nodes",
- fname, lineno, md->held_by_nodes);
+ "set to %u, but md was not referenced by any nodes. "
+ "ht_badness == %d",
+ fname, lineno, md->held_by_nodes, ht_badness);
}
tor_fragile_assert();
}