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

[or-cvs] r18827: {tor} Log cached-at-exit exit policies to try to fix bug 672. (tor/trunk/src/or)



Author: nickm
Date: 2009-03-09 11:53:37 -0400 (Mon, 09 Mar 2009)
New Revision: 18827

Modified:
   tor/trunk/src/or/policies.c
Log:
Log cached-at-exit exit policies to try to fix bug 672.

Modified: tor/trunk/src/or/policies.c
===================================================================
--- tor/trunk/src/or/policies.c	2009-03-09 12:59:20 UTC (rev 18826)
+++ tor/trunk/src/or/policies.c	2009-03-09 15:53:37 UTC (rev 18827)
@@ -1316,8 +1316,23 @@
   addr_policy_list_free(authdir_badexit_policy);
   authdir_badexit_policy = NULL;
 
-  if (!HT_EMPTY(&policy_root))
-    log_warn(LD_MM, "Still had some address policies cached at shutdown.");
+  if (!HT_EMPTY(&policy_root)) {
+    policy_map_ent_t **ent;
+    int n = 0;
+    char buf[POLICY_BUF_LEN];
+
+    log_warn(LD_MM, "Still had %d address policies cached at shutdown.",
+             (int)HT_SIZE(&policy_root));
+
+    /* Note the first 10 cached policies to try to figure out where they
+     * might be coming from. */
+    HT_FOREACH(ent, policy_map, &policy_root) {
+      if (++n > 10)
+        break;
+      if (policy_write_item(buf, sizeof(buf), (*ent)->policy, 0) >= 0)
+        log_warn(LD_MM,"  %d [%d]: %s", n, (*ent)->policy->refcnt, buf);
+    }
+  }
   HT_CLEAR(policy_map, &policy_root);
 }