From 1762b8a0ba2d0a783d9f5071c18ba3458fbc1b76 Mon Sep 17 00:00:00 2001 From: abhishekkekane Date: Fri, 12 Sep 2014 00:15:38 -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. DocImpact: Added wsgi_keep_alive option (default=True). In order to close the client socket connection explicitly after the response is sent and read successfully by the client, set wsgi_keep_alive to False. --- cinder/wsgi.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cinder/wsgi.py b/cinder/wsgi.py index 81533a6..c54ecc9 100644 --- a/cinder/wsgi.py +++ b/cinder/wsgi.py @@ -78,6 +78,10 @@ eventlet_opts = [ "max_header_line may need to be increased when using " "large tokens (typically those generated by the " "Keystone v3 API with big service catalogs)."), + cfg.BoolOpt('wsgi_keep_alive', + default=True, + help='If False, closes the client socket connection ' + 'explicitly.') ] CONF = cfg.CONF @@ -224,7 +228,8 @@ class Server(object): 'site': self.app, 'protocol': self._protocol, 'custom_pool': self._pool, - 'log': self._wsgi_logger + 'log': self._wsgi_logger, + 'keepalive': CONF.wsgi_keep_alive } self._server = eventlet.spawn(**wsgi_kwargs) -- 1.9.1