From f8f5c7a17f2a1199a737b72dd45b94e2a78804af Mon Sep 17 00:00:00 2001 From: abhishekkekane Date: Fri, 12 Sep 2014 00:24:04 -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. --- nova/wsgi.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/nova/wsgi.py b/nova/wsgi.py index 4f9a95b..0de38f6 100644 --- a/nova/wsgi.py +++ b/nova/wsgi.py @@ -69,6 +69,10 @@ wsgi_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 CONF.register_opts(wsgi_opts) @@ -210,7 +214,8 @@ class Server(object): 'custom_pool': self._pool, 'log': self._wsgi_logger, 'log_format': CONF.wsgi_log_format, - 'debug': False + 'debug': False, + 'keepalive': CONF.wsgi_keep_alive } if self._max_url_len: -- 1.9.1