[or-cvs] r9581: Fix a longstanding dnsworker-related bug: when we decide to (in tor/trunk: . doc src/or)

nickm at seul.org nickm at seul.org
Tue Feb 13 21:19:09 UTC 2007


Author: nickm
Date: 2007-02-13 16:18:56 -0500 (Tue, 13 Feb 2007)
New Revision: 9581

Modified:
   tor/trunk/
   tor/trunk/ChangeLog
   tor/trunk/doc/TODO
   tor/trunk/src/or/connection_edge.c
   tor/trunk/src/or/dns.c
Log:
 r11797 at catbus:  nickm | 2007-02-13 16:17:40 -0500
 Fix a longstanding dnsworker-related bug: when we decide to kill a DNS worker for having been in use too long, and we independently decide to close one of the exit connections waiting for that DNS worker (perhaps because we got an END relay cell), it was possible for us to try to double-free the connection.  We were smart enough to detect this and assert, but not smart enough to fix this bug before now.  This should resolve bug 390.  Backport candidate.



Property changes on: tor/trunk
___________________________________________________________________
 svk:merge ticket from /tor/trunk [r11797] on 8246c3cf-6607-4228-993b-4d95d33730f1

Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog	2007-02-13 18:23:25 UTC (rev 9580)
+++ tor/trunk/ChangeLog	2007-02-13 21:18:56 UTC (rev 9581)
@@ -2,6 +2,8 @@
   o Major bugfixes (accounting):
     - When we start during an accounting interval before it's time to wake
       up, remember to wake up at the correct time. (May fix bug 342.)
+    - Fix a longstanding obscure crash bug that could occur when
+      low on DNS resources. (Resolves bug 390.)
 
   o Major bugfixes (crashes):
     - Stop crashing when the controller asks us to resetconf more than

Modified: tor/trunk/doc/TODO
===================================================================
--- tor/trunk/doc/TODO	2007-02-13 18:23:25 UTC (rev 9580)
+++ tor/trunk/doc/TODO	2007-02-13 21:18:56 UTC (rev 9581)
@@ -232,7 +232,7 @@
       - Then clients can choose a bucket (or set of buckets) to
         download and use.
 
-  - Improvements to versioning.
+  - Improvements to versioning. (Proposal 105)
     - When we connect to a Tor server, it sends back a cell listing
       the IP it believes it is using. Use this to block dvorak's attack.
       Also, this is a fine time to say what time you think it is.

Modified: tor/trunk/src/or/connection_edge.c
===================================================================
--- tor/trunk/src/or/connection_edge.c	2007-02-13 18:23:25 UTC (rev 9580)
+++ tor/trunk/src/or/connection_edge.c	2007-02-13 21:18:56 UTC (rev 9581)
@@ -175,8 +175,8 @@
 
 /** Send a relay end cell from stream <b>conn</b> to conn's circuit,
  * with a destination of cpath_layer. (If cpath_layer is NULL, the
- * destination is the circuit's origin.) Mark the relay end cell as
- * closing because of <b>reason</b>.
+ * destination is the circuit's origin.) Set the relay end cell's
+ * reason for closing as <b>reason</b>.
  *
  * Return -1 if this function has already been called on this conn,
  * else return 0.
@@ -213,11 +213,11 @@
 
   circ = circuit_get_by_edge_conn(conn);
   if (circ && !circ->marked_for_close) {
-    log_debug(LD_EDGE,"Marking conn (fd %d) and sending end.",conn->_base.s);
+    log_debug(LD_EDGE,"Sending end on conn (fd %d).",conn->_base.s);
     connection_edge_send_command(conn, circ, RELAY_COMMAND_END,
                                  payload, payload_len, cpath_layer);
   } else {
-    log_debug(LD_EDGE,"Marking conn (fd %d); no circ to send end.",
+    log_debug(LD_EDGE,"No circ to send end on conn (fd %d).",
               conn->_base.s);
   }
 

Modified: tor/trunk/src/or/dns.c
===================================================================
--- tor/trunk/src/or/dns.c	2007-02-13 18:23:25 UTC (rev 9580)
+++ tor/trunk/src/or/dns.c	2007-02-13 21:18:56 UTC (rev 9581)
@@ -868,7 +868,8 @@
     circ = circuit_get_by_edge_conn(pendconn);
     if (circ)
       circuit_detach_stream(circ, pendconn);
-    connection_free(TO_CONN(pendconn));
+    if (!pendconn->_base.marked_for_close)
+      connection_free(TO_CONN(pendconn));
     resolve->pending_connections = pend->next;
     tor_free(pend);
   }



More information about the tor-commits mailing list