mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
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:
parent
b7cbb59bbc
commit
eb17b13b1d
@ -119,10 +119,11 @@ class ThreadWorker(base.Worker):
|
|||||||
def murder_keepalived(self):
|
def murder_keepalived(self):
|
||||||
now = time.time()
|
now = time.time()
|
||||||
while True:
|
while True:
|
||||||
if not len(self._keep):
|
try:
|
||||||
|
delta = self._keep[0].timeout - now
|
||||||
|
except IndexError:
|
||||||
break
|
break
|
||||||
|
|
||||||
delta = self._keep[0].timeout - now
|
|
||||||
if delta > 0:
|
if delta > 0:
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user