summaryrefslogtreecommitdiffstats
path: root/searchcore
diff options
context:
space:
mode:
authorOlli Virtanen <olli.virtanen@oath.com>2019-04-25 15:04:16 +0200
committerOlli Virtanen <olli.virtanen@oath.com>2019-04-25 15:04:16 +0200
commitaaec7c850168983accb3a29292e03a0ae72b8d77 (patch)
tree962be2db8d2f9dea131b3af9b2e08f804eb33da5 /searchcore
parentb186ca34ab5df612a463334772788752e1deec3c (diff)
Guard against attempting to create empty thread pool
Diffstat (limited to 'searchcore')
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/proton.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/server/proton.cpp b/searchcore/src/vespa/searchcore/proton/server/proton.cpp
index 7b27ba2fa3a..4ba8eb130a4 100644
--- a/searchcore/src/vespa/searchcore/proton/server/proton.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/proton.cpp
@@ -450,17 +450,19 @@ Proton::~Proton()
if (_fs4Server) {
_fs4Server->shutDown();
}
- // size_t numCores = _protonConfigurer.getActiveConfigSnapshot()->getBootstrapConfig()->getHwInfo().cpu().cores();
- size_t numCores = 4;
- const std::shared_ptr<proton::ProtonConfigSnapshot> pcsp = _protonConfigurer.getActiveConfigSnapshot();
- if (pcsp) {
- const std::shared_ptr<proton::BootstrapConfig> bcp = pcsp->getBootstrapConfig();
- if (bcp) {
- numCores = bcp->getHwInfo().cpu().cores();
+ if (_documentDBMap.size() > 0) {
+ size_t numCores = 4;
+ const std::shared_ptr<proton::ProtonConfigSnapshot> pcsp = _protonConfigurer.getActiveConfigSnapshot();
+ if (pcsp) {
+ const std::shared_ptr<proton::BootstrapConfig> bcp = pcsp->getBootstrapConfig();
+ if (bcp) {
+ numCores = std::max(bcp->getHwInfo().cpu().cores(), 1);
+ }
}
+
+ vespalib::ThreadStackExecutor closePool(std::min(_documentDBMap.size(), numCores), 0x20000, close_executor);
+ closeDocumentDBs(closePool);
}
- vespalib::ThreadStackExecutor closePool(std::min(_documentDBMap.size(), numCores), 0x20000, close_executor);
- closeDocumentDBs(closePool);
_documentDBMap.clear();
_persistenceEngine.reset();
_tls.reset();