Guard against attempting to create empty thread pool
@@ -450,17 +450,19 @@ Proton::~Proton()
if (_fs4Server) {
_fs4Server->shutDown();
}
- // size_t numCores = _protonConfigurer.getActiveConfigSnapshot()->getBootstrapConfig()->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 = bcp->getHwInfo().cpu().cores();
+ numCores = std::max(bcp->getHwInfo().cpu().cores(), 1);
}
}
+
vespalib::ThreadStackExecutor closePool(std::min(_documentDBMap.size(), numCores), 0x20000, close_executor);
closeDocumentDBs(closePool);
+ }
_documentDBMap.clear();
_persistenceEngine.reset();
_tls.reset();
