1
0
Fork 0

Fix immediate shutdown after startup failure. (#10365)

* Add missing dependencies to IResearchAnalyzerFeature

* First all features beginShutdown, then stop.

This is for the case of immediate shutdown if the startup did not work.
This commit is contained in:
Max Neunhöffer 2019-11-05 16:32:33 +01:00 committed by KVS85
parent 6169907f9a
commit b186aebd8d
2 changed files with 24 additions and 1 deletions

View File

@ -978,6 +978,10 @@ IResearchAnalyzerFeature::IResearchAnalyzerFeature(arangodb::application_feature
// used for getting the system database // used for getting the system database
// containing the persisted configuration // containing the persisted configuration
startsAfter("SystemDatabase"); startsAfter("SystemDatabase");
startsAfter("CommunicationPhase");
startsAfter("Aql");
startsAfter("OptimizerRules");
startsAfter("QueryRegistry");
} }
/*static*/ bool IResearchAnalyzerFeature::canUse( // check permissions /*static*/ bool IResearchAnalyzerFeature::canUse( // check permissions

View File

@ -683,6 +683,26 @@ void ApplicationServer::start() {
LOG_TOPIC("4ec19", ERR, Logger::STARTUP) << res.errorMessage() << ". shutting down"; LOG_TOPIC("4ec19", ERR, Logger::STARTUP) << res.errorMessage() << ". shutting down";
LOG_TOPIC("51732", TRACE, Logger::STARTUP) LOG_TOPIC("51732", TRACE, Logger::STARTUP)
<< "aborting startup, now stopping and unpreparing all features"; << "aborting startup, now stopping and unpreparing all features";
// try to stop all feature that we just started
for (auto it = _orderedFeatures.rbegin(); it != _orderedFeatures.rend(); ++it) {
auto feature = *it;
if (!feature->isEnabled()) {
continue;
}
if (feature->state() == ApplicationFeature::State::STARTED) {
LOG_TOPIC("e5cfe", TRACE, Logger::STARTUP)
<< "forcefully beginning stop of feature '" << feature->name() << "'";
try {
feature->beginShutdown();
} catch (...) {
// ignore errors on shutdown
LOG_TOPIC("13224", TRACE, Logger::STARTUP)
<< "caught exception while stopping feature '" << feature->name() << "'";
}
}
}
// try to stop all feature that we just started // try to stop all feature that we just started
for (auto it = _orderedFeatures.rbegin(); it != _orderedFeatures.rend(); ++it) { for (auto it = _orderedFeatures.rbegin(); it != _orderedFeatures.rend(); ++it) {
auto feature = *it; auto feature = *it;
@ -693,7 +713,6 @@ void ApplicationServer::start() {
LOG_TOPIC("e5cfd", TRACE, Logger::STARTUP) LOG_TOPIC("e5cfd", TRACE, Logger::STARTUP)
<< "forcefully stopping feature '" << feature->name() << "'"; << "forcefully stopping feature '" << feature->name() << "'";
try { try {
feature->beginShutdown();
feature->stop(); feature->stop();
feature->state(ApplicationFeature::State::STOPPED); feature->state(ApplicationFeature::State::STOPPED);
} catch (...) { } catch (...) {