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

Patch: tor-0.1.1.23 spuriously killed slow directory connections



	tor-0.1.1.23 has a bug in the code that is supposed to
close connections to directory servers that have been mute for more
than five minutes.  Instead, it closes such connections that were
opened more than five minutes ago, even if they are quite active
(because the code checks timestamp_lastwritten instead of
timestamp_lastread).

	Consequently, on a slow enough to take more than five minutes
to download the ~300KB(?) of directory information, tor can loop
indefinitely, repeatedly downloading part of the directory
information and then restarting the query.

	I think I first noticed this problem a couple of months ago
when tor stopped working on one of my internet links, but the bug
may have been there longer and only been triggered more consistently
as the amount of directory information grew.

	I wonder if there are many people on slow links who had configured
tor daemons, noticed that tor had stopped working, and just switched
their browsers to "connect to internet directly", leaving tor
to continue to its directory server read loop.

	Anyhow, the following one line change seems to fix the problem.
I have verified that I can eventually get to a web site with this
change.


Adam Richter

--- tor-0.1.1.23/src/or/main.c	2006-07-25 11:52:42.000000000 +0800
+++ tor/src/or/main.c	2006-08-29 00:30:20.000000000 +0800
@@ -627,7 +627,7 @@
 
   /* Expire any directory connections that haven't sent anything for 5 min */
   if (conn->type == CONN_TYPE_DIR &&
-      conn->timestamp_lastwritten + DIR_CONN_MAX_STALL < now) {
+      conn->timestamp_lastread + DIR_CONN_MAX_STALL < now) {
     log_info(LD_DIR,"Expiring wedged directory conn (fd %d, purpose %d)",
              conn->s, conn->purpose);
     /* This check is temporary; it's to let us know whether we should consider