summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2005-04-26 19:08:06 +0000
committerRoger Dingledine <arma@torproject.org>2005-04-26 19:08:06 +0000
commit953cf91ecd1da311f6f2ee6adcadb618d0b5de63 (patch)
tree84bbbd05445205bb1226f19a242d76828e43ce61
parent509405a5f7643f94933ae7feb0a2788a73abd801 (diff)
downloadtor-953cf91ecd1da311f6f2ee6adcadb618d0b5de63.tar.gz
tor-953cf91ecd1da311f6f2ee6adcadb618d0b5de63.zip
add more debugging info to help us find the weird dns freebsd pthreads bug.
svn:r4117
-rw-r--r--src/or/dns.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/or/dns.c b/src/or/dns.c
index 0690422fb4..8c5c7bc4e2 100644
--- a/src/or/dns.c
+++ b/src/or/dns.c
@@ -138,7 +138,7 @@ static void purge_expired_resolves(uint32_t now) {
resolve = oldest_cached_resolve;
log(LOG_DEBUG,"Forgetting old cached resolve (expires %lu)", (unsigned long)resolve->expire);
if (resolve->state == CACHE_STATE_PENDING) {
- log_fn(LOG_WARN,"Bug: Expiring a dns resolve that's still pending. Forgot to cull it?");
+ log_fn(LOG_WARN,"Bug: Expiring a dns resolve ('%s') that's still pending. Forgot to cull it?", resolve->address);
tor_fragile_assert();
}
if (resolve->pending_connections) {
@@ -631,8 +631,19 @@ int connection_dns_process_inbuf(connection_t *conn) {
tor_assert(conn->type == CONN_TYPE_DNSWORKER);
if (conn->state != DNSWORKER_STATE_BUSY && buf_datalen(conn->inbuf)) {
- log_fn(LOG_WARN,"Bug: read data (%d bytes) from an idle dns worker (address '%s'. Please report.", (int)buf_datalen(conn->inbuf), conn->address);
+ log_fn(LOG_WARN,"Bug: read data (%d bytes) from an idle dns worker (fd %d, address '%s'). Please report.",
+ (int)buf_datalen(conn->inbuf), conn->s, conn->address);
tor_fragile_assert();
+
+ /* Pull it off the buffer anyway, or it will just stay there.
+ * Keep pulling things off because sometimes we get several
+ * answers at once (!). */
+ while (buf_datalen(conn->inbuf)) {
+ connection_fetch_from_buf(&success,1,conn);
+ connection_fetch_from_buf((char *)&addr,sizeof(uint32_t),conn);
+ log_fn(LOG_WARN,"Discarding idle dns answer (success %d, addr %d.)",
+ success, addr);
+ }
return 0;
}
if (buf_datalen(conn->inbuf) < 5) /* entire answer available? */