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

[or-cvs] Finally solve the "closing wedged cpuworkers" bug. Woo.



Update of /home2/or/cvsroot/tor/src/or
In directory moria:/home/arma/work/onion/cvs/tor/src/or

Modified Files:
	cpuworker.c dns.c 
Log Message:
Finally solve the "closing wedged cpuworkers" bug. Woo.

This happened when we got two create cells in a row from the same TLS
connection. It would hand one to the cpuworker, and then immediately
handle the second one -- after it had registered that the first one was
busy, but before it had updated the timestamp that we use to decide how
*long* it's been busy.


Index: cpuworker.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/cpuworker.c,v
retrieving revision 1.103
retrieving revision 1.104
diff -u -p -d -r1.103 -r1.104
--- cpuworker.c	6 Jun 2006 00:06:52 -0000	1.103
+++ cpuworker.c	12 Jun 2006 11:59:19 -0000	1.104
@@ -476,6 +476,10 @@ assign_to_cpuworker(connection_t *cpuwor
     tag_pack(tag, circ->p_conn->addr, circ->p_conn->port, circ->p_circ_id);
 
     cpuworker->state = CPUWORKER_STATE_BUSY_ONION;
+    /* touch the lastwritten timestamp, since that's how we check to
+     * see how long it's been since we asked the question, and sometimes
+     * we check before the first call to connection_handle_write(). */
+    cpuworker->timestamp_lastwritten = time(NULL);
     num_cpuworkers_busy++;
 
     connection_write_to_buf((char*)&question_type, 1, cpuworker);

Index: dns.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/dns.c,v
retrieving revision 1.190
retrieving revision 1.191
diff -u -p -d -r1.190 -r1.191
--- dns.c	6 Jun 2006 00:06:52 -0000	1.190
+++ dns.c	12 Jun 2006 11:59:19 -0000	1.191
@@ -701,6 +701,10 @@ assign_to_dnsworker(connection_t *exitco
   tor_free(dnsconn->address);
   dnsconn->address = tor_strdup(exitconn->address);
   dnsconn->state = DNSWORKER_STATE_BUSY;
+  /* touch the lastwritten timestamp, since that's how we check to
+   * see how long it's been since we asked the question, and sometimes
+   * we check before the first call to connection_handle_write(). */
+  dnsconn->timestamp_lastwritten = time(NULL);
   num_dnsworkers_busy++;
 
   len = strlen(dnsconn->address);