From adb21217955e59fce5fb194635b36b5b40d6d8c8 Mon Sep 17 00:00:00 2001 From: Steve Baker Date: Fri, 18 Dec 2015 09:10:46 +1300 Subject: [PATCH] Make minimum default num_engine_workers>=4 Downstream test environments are frequently having failing stacks with error messages like: MessagingTimeout: resources[0]: Timed out waiting for a reply to message ID ... These environments generally have 1 or 2 cores, so only spawn one or two engine workers. This deadlocks with stacks that have many nested stacks due to engine->engine RPC calls. Even our own functional tests don't work reliably with less than 4 workers, and the workaround has been to set that explicitly in pre_test_hook.sh. This change sets the default minimum number of workers to 4, but still matches workers to cores for larger servers. This change also moves the default evaluation to heat.cmd.engine so that generated configuration doesn't get a inappropriate default value. Change-Id: Iae6b3956bad414406d901bb2213c9ec230ff4304 Closes-Bug: #1526045 --- heat/cmd/engine.py | 8 ++++++-- heat/common/config.py | 2 -- heat_integrationtests/pre_test_hook.sh | 1 - 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/heat/cmd/engine.py b/heat/cmd/engine.py index f134ffdad..d3858943a 100644 --- a/heat/cmd/engine.py +++ b/heat/cmd/engine.py @@ -24,6 +24,7 @@ eventlet.monkey_patch() import sys +from oslo_concurrency import processutils from oslo_config import cfg import oslo_i18n as i18n from oslo_log import log as logging @@ -66,8 +67,11 @@ def main(): profiler.setup('heat-engine', cfg.CONF.host) gmr.TextGuruMeditation.setup_autorun(version) srv = engine.EngineService(cfg.CONF.host, rpc_api.ENGINE_TOPIC) - launcher = service.launch(cfg.CONF, srv, - workers=cfg.CONF.num_engine_workers) + workers = cfg.CONF.num_engine_workers + if not workers: + workers = max(4, processutils.get_worker_count()) + + launcher = service.launch(cfg.CONF, srv, workers=workers) if cfg.CONF.enable_cloud_watch_lite: # We create the periodic tasks here, which mean they are created # only in the parent process when num_engine_workers>1 is specified diff --git a/heat/common/config.py b/heat/common/config.py index 15b5af51a..f0acec362 100644 --- a/heat/common/config.py +++ b/heat/common/config.py @@ -15,7 +15,6 @@ import os from eventlet.green import socket -from oslo_concurrency import processutils from oslo_config import cfg from oslo_log import log as logging @@ -81,7 +80,6 @@ service_opts = [ default=5, help=_('Maximum depth allowed when using nested stacks.')), cfg.IntOpt('num_engine_workers', - default=processutils.get_worker_count(), help=_('Number of heat-engine processes to fork and run.'))] engine_opts = [ diff --git a/heat_integrationtests/pre_test_hook.sh b/heat_integrationtests/pre_test_hook.sh index 688003b37..f738dc9b0 100755 --- a/heat_integrationtests/pre_test_hook.sh +++ b/heat_integrationtests/pre_test_hook.sh @@ -27,7 +27,6 @@ if [ "$ENABLE_CONVERGENCE" == "true" ] ; then fi echo -e 'notification_driver=messagingv2\n' >> $localconf -echo -e 'num_engine_workers=4\n' >> $localconf echo -e 'hidden_stack_tags=hidden\n' >> $localconf echo -e 'encrypt_parameters_and_properties=True\n' >> $localconf