Merge "Adds eventlet monkey patching of select module if thread is pathed"

This commit is contained in:
Jenkins 2016-04-15 21:07:41 +00:00 committed by Gerrit Code Review
commit badc0d1477
4 changed files with 14 additions and 5 deletions

View File

@ -407,8 +407,12 @@ def run_server(conf, logger, sock, global_conf=None):
wsgi.WRITE_TIMEOUT = int(conf.get('client_timeout') or 60)
eventlet.hubs.use_hub(get_hub())
# NOTE(sileht): monkey-patching thread is required by python-keystoneclient
eventlet.patcher.monkey_patch(all=False, socket=True, thread=True)
# NOTE(sileht):
# monkey-patching thread is required by python-keystoneclient;
# monkey-patching select is required by oslo.messaging pika driver
# if thread is monkey-patched.
eventlet.patcher.monkey_patch(all=False, socket=True, select=True,
thread=True)
eventlet_debug = config_true_value(conf.get('eventlet_debug', 'no'))
eventlet.debug.hub_exceptions(eventlet_debug)
wsgi_logger = NullLogger()

View File

@ -143,7 +143,8 @@ class ContainerUpdater(Daemon):
pid2filename[pid] = tmpfilename
else:
signal.signal(signal.SIGTERM, signal.SIG_DFL)
patcher.monkey_patch(all=False, socket=True, thread=True)
patcher.monkey_patch(all=False, socket=True, select=True,
thread=True)
self.no_changes = 0
self.successes = 0
self.failures = 0
@ -177,7 +178,7 @@ class ContainerUpdater(Daemon):
"""
Run the updater once.
"""
patcher.monkey_patch(all=False, socket=True, thread=True)
patcher.monkey_patch(all=False, socket=True, select=True, thread=True)
self.logger.info(_('Begin container update single threaded sweep'))
begin = time.time()
self.no_changes = 0

View File

@ -94,7 +94,8 @@ class ObjectUpdater(Daemon):
pids.append(pid)
else:
signal.signal(signal.SIGTERM, signal.SIG_DFL)
patcher.monkey_patch(all=False, socket=True, thread=True)
patcher.monkey_patch(all=False, socket=True, select=True,
thread=True)
self.successes = 0
self.failures = 0
forkbegin = time.time()

View File

@ -380,6 +380,7 @@ class TestWSGI(unittest.TestCase):
_eventlet.hubs.use_hub.assert_called_with(utils.get_hub())
_eventlet.patcher.monkey_patch.assert_called_with(all=False,
socket=True,
select=True,
thread=True)
_eventlet.debug.hub_exceptions.assert_called_with(False)
self.assertTrue(_wsgi.server.called)
@ -468,6 +469,7 @@ class TestWSGI(unittest.TestCase):
_eventlet.hubs.use_hub.assert_called_with(utils.get_hub())
_eventlet.patcher.monkey_patch.assert_called_with(all=False,
socket=True,
select=True,
thread=True)
_eventlet.debug.hub_exceptions.assert_called_with(False)
self.assertTrue(_wsgi.server.called)
@ -520,6 +522,7 @@ class TestWSGI(unittest.TestCase):
_eventlet.hubs.use_hub.assert_called_with(utils.get_hub())
_eventlet.patcher.monkey_patch.assert_called_with(all=False,
socket=True,
select=True,
thread=True)
_eventlet.debug.hub_exceptions.assert_called_with(True)
self.assertTrue(mock_server.called)