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

[tor-commits] [arm/release] fix: concurrency issue could crash from CIRC event



commit e884fcbd894c9e764c60e6b40c5bd3e14583352e
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Sat Sep 24 13:03:20 2011 -0700

    fix: concurrency issue could crash from CIRC event
    
    If we got a CIRC event while populating the cache of relays that we're attached
    to we could reset _fingerprintsAttachedCache to None while we were in the
    middle of populating it. Manipulation of this cache is supposed to be governed
    by the connection lock, so fixing that for the CIRC event's reset.
---
 src/util/torTools.py |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/util/torTools.py b/src/util/torTools.py
index e59b35e..3d18fcb 100644
--- a/src/util/torTools.py
+++ b/src/util/torTools.py
@@ -2004,7 +2004,9 @@ class Controller(TorCtl.PostEventListener):
     
     # CIRC events aren't required, but if one's received then flush this cache
     # since it uses circuit-status results.
+    self.connLock.acquire()
     self._fingerprintsAttachedCache = None
+    self.connLock.release()
     
     self._cachedParam["circuits"] = None
   
@@ -2085,6 +2087,10 @@ class Controller(TorCtl.PostEventListener):
       relayPort    - orport of relay (to further narrow the results)
     """
     
+    # Events can reset _fingerprintsAttachedCache to None, so all uses of this
+    # function need to be under the connection lock (skipping that might also
+    # scew with the conn usage of this function...)
+    
     # If we were provided with a string port then convert to an int (so
     # lookups won't mismatch based on type).
     if isinstance(relayPort, str): relayPort = int(relayPort)



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits