diff --git a/as/src/base/batch.c b/as/src/base/batch.c index 684230e7..be9646ac 100644 --- a/as/src/base/batch.c +++ b/as/src/base/batch.c @@ -812,6 +812,10 @@ as_batch_init() // Default 'batch-index-threads' can't be set before call to cf_topo_init(). if (g_config.n_batch_index_threads == 0) { g_config.n_batch_index_threads = cf_topo_count_cpus(); + + if (g_config.n_batch_index_threads > MAX_BATCH_THREADS) { + g_config.n_batch_index_threads = MAX_BATCH_THREADS; + } } cf_info(AS_BATCH, "starting %u batch-index-threads", g_config.n_batch_index_threads); diff --git a/as/src/base/cfg.c b/as/src/base/cfg.c index a532bb56..909de151 100644 --- a/as/src/base/cfg.c +++ b/as/src/base/cfg.c @@ -4365,6 +4365,10 @@ as_config_post_process(as_config* c, const char* config_file) if (c->n_service_threads == 0) { c->n_service_threads = c->n_namespaces_not_inlined != 0 ? n_cpus * 5 : n_cpus; + + if (c->n_service_threads > MAX_SERVICE_THREADS) { + c->n_service_threads = MAX_SERVICE_THREADS; + } } // Setup performance metrics histograms.