From 44d3ac8451548d4951a6326309817bafbd5ae7c3 Mon Sep 17 00:00:00 2001 From: benoitc Date: Sat, 21 May 2016 00:08:59 +0200 Subject: [PATCH] gthread: handle removed socket in the select loop when it happend there are good chance the socket has been removed because it timeouted on the other end. So ignore it. fix #1258 --- gunicorn/workers/gthread.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gunicorn/workers/gthread.py b/gunicorn/workers/gthread.py index 7327a318..fcdcc7a7 100644 --- a/gunicorn/workers/gthread.py +++ b/gunicorn/workers/gthread.py @@ -179,6 +179,9 @@ class ThreadWorker(base.Worker): except EnvironmentError as e: if e.errno != errno.EBADF: raise + except KeyError: + # already removed by the system, continue + pass # close the socket conn.close()