[tor-commits] [tor/release-0.2.9] Fix a traceback when closing a blocked connection "immediately".

nickm at torproject.org nickm at torproject.org
Tue Dec 12 14:13:55 UTC 2017


commit 95238eb9174f0cfee9d313ce15b4f9b471f3d0e5
Author: Nick Mathewson <nickm at torproject.org>
Date:   Thu Nov 16 11:45:15 2017 -0500

    Fix a traceback when closing a blocked connection "immediately".
    
    When we close a connection via connection_close_immediately, we kill
    its events immediately. But if it had been blocked on bandwidth
    read/write, we could try to re-add its (nonexistent) events later
    from connection_bucket_refill -- if we got to that callback before
    we swept the marked connections.
    
    Fixes bug 24167.  Fortunately, this hasn't been a crash bug since we
    introduced connection_check_event in 0.2.9.10, and backported it.
    
    This is a bugfix on commit 89d422914a0c3cb, I believe, which
    appeared in Tor 0.1.0.1-rc.
---
 changes/bug24167    | 7 +++++++
 src/or/connection.c | 4 ++++
 2 files changed, 11 insertions(+)

diff --git a/changes/bug24167 b/changes/bug24167
new file mode 100644
index 000000000..fd0d87eff
--- /dev/null
+++ b/changes/bug24167
@@ -0,0 +1,7 @@
+  o Minor bugfixes (network layer):
+    - When closing a connection via close_connection_immediately(), we
+      mark it as "not blocked on bandwidth", to prevent later calls
+      from trying to unblock it, and give it permission to read. This
+      fixes a backtrace warning that can happen on relays under various
+      circumstances. Fixes bug 24167; bugfix on 0.1.0.1-rc.
+
diff --git a/src/or/connection.c b/src/or/connection.c
index 276dca281..61f4f5aa6 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -721,6 +721,10 @@ connection_close_immediate(connection_t *conn)
 
   connection_unregister_events(conn);
 
+  /* Prevent the event from getting unblocked. */
+  conn->read_blocked_on_bw =
+    conn->write_blocked_on_bw = 0;
+
   if (SOCKET_OK(conn->s))
     tor_close_socket(conn->s);
   conn->s = TOR_INVALID_SOCKET;





More information about the tor-commits mailing list