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) wsgi.WRITE_TIMEOUT = int(conf.get('client_timeout') or 60)
eventlet.hubs.use_hub(get_hub()) eventlet.hubs.use_hub(get_hub())
# NOTE(sileht): monkey-patching thread is required by python-keystoneclient # NOTE(sileht):
eventlet.patcher.monkey_patch(all=False, socket=True, thread=True) # 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 = config_true_value(conf.get('eventlet_debug', 'no'))
eventlet.debug.hub_exceptions(eventlet_debug) eventlet.debug.hub_exceptions(eventlet_debug)
wsgi_logger = NullLogger() wsgi_logger = NullLogger()

View File

@ -143,7 +143,8 @@ class ContainerUpdater(Daemon):
pid2filename[pid] = tmpfilename pid2filename[pid] = tmpfilename
else: else:
signal.signal(signal.SIGTERM, signal.SIG_DFL) 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.no_changes = 0
self.successes = 0 self.successes = 0
self.failures = 0 self.failures = 0
@ -177,7 +178,7 @@ class ContainerUpdater(Daemon):
""" """
Run the updater once. 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')) self.logger.info(_('Begin container update single threaded sweep'))
begin = time.time() begin = time.time()
self.no_changes = 0 self.no_changes = 0

View File

@ -94,7 +94,8 @@ class ObjectUpdater(Daemon):
pids.append(pid) pids.append(pid)
else: else:
signal.signal(signal.SIGTERM, signal.SIG_DFL) 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.successes = 0
self.failures = 0 self.failures = 0
forkbegin = time.time() forkbegin = time.time()

View File

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