]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Eventlet green threads not released back to pool
authorabhishekkekane <abhishek.kekane@nttdata.com>
Tue, 21 Oct 2014 09:31:15 +0000 (02:31 -0700)
committerabhishekkekane <abhishek.kekane@nttdata.com>
Fri, 24 Oct 2014 21:35:46 +0000 (14:35 -0700)
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 maintain the backward compatibility, setting wsgi_keep_alive
as True by default. Recommended is set it to False.

SecurityImpact

Closes-Bug: #1361360
Change-Id: Ic57b2aceb136e8626388cfe4df72b2f47cb0661c

cinder/wsgi.py
etc/cinder/cinder.conf.sample

index a7cfbcb495d64b5cb1edb38121e6559d875e3879..ff4b2d54578551a0e290ddb7ea8f4413b4f7acba 100644 (file)
@@ -84,6 +84,11 @@ eventlet_opts = [
                     "If an incoming connection is idle for this number of "
                     "seconds it will be closed. A value of \'0\' means "
                     "wait forever."),
+    cfg.BoolOpt('wsgi_keep_alive',
+                default=True,
+                help='If False, closes the client socket connection '
+                     'explicitly. Setting it to True to maintain backward '
+                     'compatibility. Recommended setting is set it to False.'),
 ]
 
 CONF = cfg.CONF
@@ -236,7 +241,8 @@ class Server(object):
             'protocol': self._protocol,
             'custom_pool': self._pool,
             'log': self._wsgi_logger,
-            'socket_timeout': self.client_socket_timeout
+            'socket_timeout': self.client_socket_timeout,
+            'keepalive': CONF.wsgi_keep_alive
         }
 
         self._server = eventlet.spawn(**wsgi_kwargs)
index 656393c76ffae5c36f33cde46b26b6c2abc840d4..6665e30cef7a7201cc9034793e3241eab9ff0aef 100644 (file)
 # value)
 #client_socket_timeout=900
 
+# If False, closes the client socket connection explicitly.
+# Setting it to True to maintain backward compatibility.
+# Recommended setting is set it to False. (boolean value)
+#wsgi_keep_alive=true
+
 # Sets the value of TCP_KEEPALIVE (True/False) for each server
 # socket. (boolean value)
 #tcp_keepalive=true