Merge "Eventlet green threads not released back to pool" into stable/icehouse

This commit is contained in:
Jenkins 2015-06-01 16:26:26 +00:00 committed by Gerrit Code Review
commit c7487c2638
2 changed files with 21 additions and 1 deletions

View File

@ -157,6 +157,21 @@ class TestWSGIServer(test.NoDBTestCase):
server.stop()
server.wait()
def test_wsgi_keep_alive(self):
self.flags(wsgi_keep_alive=False)
# mocking eventlet spawn method to check it is called with
# configured 'wsgi_keep_alive' value.
with mock.patch.object(eventlet,
'spawn') as mock_spawn:
server = nova.wsgi.Server("test_app", None,
host="127.0.0.1", port=0)
server.start()
_, kwargs = mock_spawn.call_args
self.assertEqual(CONF.wsgi_keep_alive,
kwargs['keepalive'])
server.stop()
class TestWSGIServerWithSSL(test.NoDBTestCase):
"""WSGI server with SSL tests."""

View File

@ -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)
@ -206,7 +210,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: