From 82ac8c38651e92eebba887b0588b0bf7fd91e232 Mon Sep 17 00:00:00 2001 From: abhishekkekane Date: Thu, 11 Sep 2014 23:39:41 -0700 Subject: [PATCH] Eventlet green threads not released back to pool Presently, the wsgi server allows persist connections hence even after the response is sent to the client, it doesn't close the client socket connection. Because of this problem, the green thread is not released back to the pool. In order to close the client socket connection explicitly after the response is sent and read successfully by the client, you simply have to set keepalive to False when you create a wsgi server. --- glance/common/wsgi.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/glance/common/wsgi.py b/glance/common/wsgi.py index 99bd183..3870d95 100644 --- a/glance/common/wsgi.py +++ b/glance/common/wsgi.py @@ -340,7 +340,8 @@ class Server(object): self.application, log=logging.WritableLogger(self.logger), custom_pool=self.pool, - debug=False) + debug=False, + keepalive=False) except socket.error as err: if err[0] != errno.EINVAL: raise @@ -351,7 +352,7 @@ class Server(object): self.logger.info(_("Starting single process server")) eventlet.wsgi.server(sock, application, custom_pool=self.pool, log=logging.WritableLogger(self.logger), - debug=False) + debug=False, keepalive=False) class Middleware(object): -- 1.9.1