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.

Icehouse backport note: socket_timeout was dropped, it was introduced
in 0.14[*] and Icehouse eventlet lower bound is 0.13

[*] 7d4916f014

DocImpact:
Added wsgi_keep_alive option (default=True).

SecurityImpact

Closes-Bug: #1361360
Change-Id: I3a361d6590d1800b85791f23ac1cdfd79815341b
(cherry picked from commit 8e7a0dbb12)
This commit is contained in:
abhishekkekane 2014-10-21 04:15:15 -07:00 committed by Alan Pevec
parent ed3d4efb1f
commit 4cdbefc202
2 changed files with 15 additions and 1 deletions

View File

@ -264,6 +264,12 @@ notification_driver = neutron.openstack.common.notifier.rpc_notifier
# enabled for various plugins for compatibility.
# rpc_workers = 0
# wsgi keepalive option. Determines if connections are allowed to be held open
# by clients after a request is fulfilled. A value of False will ensure that
# the socket connection will be explicitly closed once a response has been
# sent to the client.
# wsgi_keep_alive = True
# Sets the value of TCP_KEEPIDLE in seconds to use for each server socket when
# starting API server. Not supported on OS X.
# tcp_keepidle = 600

View File

@ -76,6 +76,13 @@ socket_opts = [
default=None,
help=_("Private key file to use when starting "
"the server securely")),
cfg.BoolOpt('wsgi_keep_alive',
default=True,
help=_("Determines if connections are allowed to be held "
"open by clients after a request is fulfilled. A "
"value of False will ensure that the socket "
"connection will be explicitly closed once a response "
"has been sent to the client.")),
]
CONF = cfg.CONF
@ -246,7 +253,8 @@ class Server(object):
def _run(self, application, socket):
"""Start a WSGI server in a new green thread."""
eventlet.wsgi.server(socket, application, custom_pool=self.pool,
log=logging.WritableLogger(LOG))
log=logging.WritableLogger(LOG),
keepalive=CONF.wsgi_keep_alive)
class Middleware(object):