]> 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)
committerThomas Goirand <thomas@goirand.fr>
Sun, 14 Dec 2014 09:18:31 +0000 (09:18 +0000)
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.

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

SecurityImpact

Closes-Bug: #1361360
Change-Id: Ic57b2aceb136e8626388cfe4df72b2f47cb0661c
(cherry picked from commit fc87da7eeb3451e139ee71b31095d0b9093332ce)

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

index 77ddba6d59773f800e38563d82f8ca762fccd11b..56ebfd6abb910dd66f9be0180121abbad51fc10e 100644 (file)
@@ -79,6 +79,11 @@ 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. Setting it to True to maintain backward '
+                     'compatibility. Recommended setting is set it to False.'),
 ]
 
 CONF = cfg.CONF
@@ -229,7 +234,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)
index b66275be0bc954944ef0fa4630a8fdc57696eb46..3f1128c6dabd7b851f872ccb9897a41f4a18c16b 100644 (file)
 # with big service catalogs). (integer value)
 #max_header_line=16384
 
+# 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