[tor-commits] [tor/master] More debugging code to try to track down #17659
nickm at torproject.org
nickm at torproject.org
Wed Dec 16 13:37:57 UTC 2015
commit a03469aa851bf6e658d539e95b5f1e786f9622bc
Author: Nick Mathewson <nickm at torproject.org>
Date: Wed Dec 16 08:37:40 2015 -0500
More debugging code to try to track down #17659
---
src/or/connection_edge.c | 31 ++++++++++++++++++++++++++++---
src/or/or.h | 7 +++++++
2 files changed, 35 insertions(+), 3 deletions(-)
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index 7a2de29..961e49a 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -780,6 +780,15 @@ connection_ap_rescan_and_attach_pending(void)
connection_ap_attach_pending(1);
}
+#ifdef DEBUGGING_17659
+#define UNMARK() do { \
+ entry_conn->marked_pending_circ_line = 0; \
+ entry_conn->marked_pending_circ_file = 0; \
+ } while (0)
+#else
+#define UNMARK() do { } while (0)
+#endif
+
/** Tell any AP streams that are listed as waiting for a new circuit to try
* again, either attaching to an available circ or launching a new one.
*
@@ -801,12 +810,14 @@ connection_ap_attach_pending(int retry)
connection_t *conn = ENTRY_TO_CONN(entry_conn);
tor_assert(conn && entry_conn);
if (conn->marked_for_close) {
+ UNMARK();
SMARTLIST_DEL_CURRENT(pending_entry_connections, entry_conn);
continue;
}
if (conn->magic != ENTRY_CONNECTION_MAGIC) {
- log_warn(LD_BUG, "%p has impossible magic value %u",
+ log_warn(LD_BUG, "%p has impossible magic value %u.",
entry_conn, (unsigned)conn->magic);
+ UNMARK();
SMARTLIST_DEL_CURRENT(pending_entry_connections, entry_conn);
continue;
}
@@ -815,6 +826,7 @@ connection_ap_attach_pending(int retry)
"is %s. Why is it on pending_entry_connections?",
entry_conn,
conn_state_to_string(conn->type, conn->state));
+ UNMARK();
SMARTLIST_DEL_CURRENT(pending_entry_connections, entry_conn);
continue;
}
@@ -828,6 +840,7 @@ connection_ap_attach_pending(int retry)
if (conn->marked_for_close ||
conn->type != CONN_TYPE_AP ||
conn->state != AP_CONN_STATE_CIRCUIT_WAIT) {
+ UNMARK();
SMARTLIST_DEL_CURRENT(pending_entry_connections, entry_conn);
continue;
}
@@ -862,12 +875,23 @@ connection_ap_mark_as_pending_circuit_(entry_connection_t *entry_conn,
if (PREDICT_UNLIKELY(smartlist_contains(pending_entry_connections,
entry_conn))) {
log_warn(LD_BUG, "What?? pending_entry_connections already contains %p! "
- "(called from %s:%d)",
+ "(Called from %s:%d.)",
entry_conn, fname, lineno);
- log_backtrace(LOG_WARN, LD_BUG, "To debug, this may help.");
+#ifdef DEBUGGING_17659
+ const char *f2 = entry_conn->marked_pending_circ_file;
+ log_warn(LD_BUG, "(Previously called from %s:%d.)\n",
+ f2 ? f2 : "<NULL>",
+ entry_conn->marked_pending_circ_line);
+#endif
+ log_backtrace(LOG_WARN, LD_BUG, "To debug, this may help");
return;
}
+#ifdef DEBUGGING_17659
+ entry_conn->marked_pending_circ_line = (uint16_t) lineno;
+ entry_conn->marked_pending_circ_file = fname;
+#endif
+
untried_pending_connections = 1;
smartlist_add(pending_entry_connections, entry_conn);
}
@@ -878,6 +902,7 @@ connection_ap_mark_as_non_pending_circuit(entry_connection_t *entry_conn)
{
if (PREDICT_UNLIKELY(NULL == pending_entry_connections))
return;
+ UNMARK();
smartlist_remove(pending_entry_connections, entry_conn);
}
diff --git a/src/or/or.h b/src/or/or.h
index e92a4bb..e621fe9 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -1646,6 +1646,13 @@ typedef struct entry_connection_t {
* request that we're going to try to answer. */
struct evdns_server_request *dns_server_request;
+#define DEBUGGING_17659
+
+#ifdef DEBUGGING_17659
+ uint16_t marked_pending_circ_line;
+ const char *marked_pending_circ_file;
+#endif
+
#define NUM_CIRCUITS_LAUNCHED_THRESHOLD 10
/** Number of times we've launched a circuit to handle this stream. If
* it gets too high, that could indicate an inconsistency between our
More information about the tor-commits
mailing list