From d0f1ff659f404275172eb4072d98777ea9953449 Mon Sep 17 00:00:00 2001 From: Jonas Maurus Date: Mon, 3 Nov 2014 15:41:17 +0000 Subject: [PATCH 1/2] fix #921 by passing socket.error on to the caller (where it will be ignored) --- gunicorn/workers/async.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gunicorn/workers/async.py b/gunicorn/workers/async.py index feba3b08..4f8f7d68 100644 --- a/gunicorn/workers/async.py +++ b/gunicorn/workers/async.py @@ -118,6 +118,10 @@ class AsyncWorker(base.Worker): raise StopIteration() except StopIteration: raise + except socket.error: + # If the original exception was a socket.error we delegate + # handling it to the caller (where handle() might ignore it). + raise except Exception: if resp and resp.headers_sent: # If the requests have already been sent, we should close the From fbc1e29c72bdd2fb90c599a719fee88bf95386d4 Mon Sep 17 00:00:00 2001 From: Jonas Maurus Date: Wed, 12 Nov 2014 09:50:10 +0000 Subject: [PATCH 2/2] use six.reraise to amend the traceback --- gunicorn/workers/async.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gunicorn/workers/async.py b/gunicorn/workers/async.py index 4f8f7d68..a9001fb8 100644 --- a/gunicorn/workers/async.py +++ b/gunicorn/workers/async.py @@ -120,8 +120,8 @@ class AsyncWorker(base.Worker): raise except socket.error: # If the original exception was a socket.error we delegate - # handling it to the caller (where handle() might ignore it). - raise + # handling it to the caller (where handle() might ignore it + six.reraise(*sys.exc_info()) except Exception: if resp and resp.headers_sent: # If the requests have already been sent, we should close the