Guard against race condition on threads keepalive

Requests after the first on a keepalive connection remove themselves
from the keepalive timeout queue. This presents a race condition where
the main thread might try to access the first element of the queue
after it has been removed.
This commit is contained in:
Randall Leeds 2014-05-31 13:28:16 -07:00
parent b7cbb59bbc
commit eb17b13b1d

View File

@ -119,10 +119,11 @@ class ThreadWorker(base.Worker):
def murder_keepalived(self):
now = time.time()
while True:
if not len(self._keep):
try:
delta = self._keep[0].timeout - now
except IndexError:
break
delta = self._keep[0].timeout - now
if delta > 0:
break
else: