mirror of https://github.com/Icinga/icinga2.git
Fix crash in Dependency::Stop()
This partially reverts the fix in #8436 fixes #8687 refs #8436 Conflicts: lib/db_ido_pgsql/idopgsqlconnection.cpp
This commit is contained in:
parent
e1a07ad129
commit
64214bd853
|
@ -57,7 +57,6 @@ static bool l_InExceptionHandler = false;
|
||||||
int Application::m_ArgC;
|
int Application::m_ArgC;
|
||||||
char **Application::m_ArgV;
|
char **Application::m_ArgV;
|
||||||
double Application::m_StartTime;
|
double Application::m_StartTime;
|
||||||
int Application::m_ExitStatus = 0;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for the Application class.
|
* Constructor for the Application class.
|
||||||
|
@ -107,6 +106,12 @@ Application::~Application(void)
|
||||||
|
|
||||||
void Application::Exit(int rc)
|
void Application::Exit(int rc)
|
||||||
{
|
{
|
||||||
|
if (rc)
|
||||||
|
Log(LogCritical, "Application")
|
||||||
|
<< "Shutting down after a fatal error; exit code: " << rc;
|
||||||
|
else
|
||||||
|
Log(LogInformation, "Application", "Shutting down...");
|
||||||
|
|
||||||
std::cout.flush();
|
std::cout.flush();
|
||||||
|
|
||||||
BOOST_FOREACH(const Logger::Ptr& logger, Logger::GetLoggers()) {
|
BOOST_FOREACH(const Logger::Ptr& logger, Logger::GetLoggers()) {
|
||||||
|
@ -310,11 +315,6 @@ mainloop:
|
||||||
goto mainloop;
|
goto mainloop;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_ExitStatus)
|
|
||||||
Log(LogInformation, "Application", "Shutting down Icinga after a fatal error.");
|
|
||||||
else
|
|
||||||
Log(LogInformation, "Application", "Shutting down Icinga...");
|
|
||||||
|
|
||||||
DynamicObject::StopObjects();
|
DynamicObject::StopObjects();
|
||||||
Application::GetInstance()->OnShutdown();
|
Application::GetInstance()->OnShutdown();
|
||||||
|
|
||||||
|
@ -361,9 +361,10 @@ pid_t Application::StartReloadProcess(void)
|
||||||
* Signals the application to shut down during the next
|
* Signals the application to shut down during the next
|
||||||
* execution of the event loop.
|
* execution of the event loop.
|
||||||
*/
|
*/
|
||||||
void Application::RequestShutdown(int rc)
|
void Application::RequestShutdown(void)
|
||||||
{
|
{
|
||||||
m_ExitStatus = rc > m_ExitStatus ? rc : m_ExitStatus;
|
Log(LogInformation, "Application", "Received request to shut down.");
|
||||||
|
|
||||||
m_ShuttingDown = true;
|
m_ShuttingDown = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,7 @@ public:
|
||||||
|
|
||||||
static void InstallExceptionHandlers(void);
|
static void InstallExceptionHandlers(void);
|
||||||
|
|
||||||
static void RequestShutdown(int rc = 0);
|
static void RequestShutdown(void);
|
||||||
static void RequestRestart(void);
|
static void RequestRestart(void);
|
||||||
static void RequestReopenLogs(void);
|
static void RequestReopenLogs(void);
|
||||||
|
|
||||||
|
@ -162,7 +162,6 @@ private:
|
||||||
static bool m_Debugging; /**< Whether debugging is enabled. */
|
static bool m_Debugging; /**< Whether debugging is enabled. */
|
||||||
static LogSeverity m_DebuggingSeverity; /**< Whether debugging severity is set. */
|
static LogSeverity m_DebuggingSeverity; /**< Whether debugging severity is set. */
|
||||||
static double m_StartTime;
|
static double m_StartTime;
|
||||||
static int m_ExitStatus;
|
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
static void SigIntTermHandler(int signum);
|
static void SigIntTermHandler(int signum);
|
||||||
|
|
|
@ -225,8 +225,7 @@ void IdoMysqlConnection::Reconnect(void)
|
||||||
if (!row) {
|
if (!row) {
|
||||||
Log(LogCritical, "IdoMysqlConnection", "Schema does not provide any valid version! Verify your schema installation.");
|
Log(LogCritical, "IdoMysqlConnection", "Schema does not provide any valid version! Verify your schema installation.");
|
||||||
|
|
||||||
Application::RequestShutdown(EXIT_FAILURE);
|
Application::Exit(EXIT_FAILURE);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DiscardRows(result);
|
DiscardRows(result);
|
||||||
|
@ -238,8 +237,7 @@ void IdoMysqlConnection::Reconnect(void)
|
||||||
<< "Schema version '" << version << "' does not match the required version '"
|
<< "Schema version '" << version << "' does not match the required version '"
|
||||||
<< SCHEMA_VERSION << "'! Please check the upgrade documentation.";
|
<< SCHEMA_VERSION << "'! Please check the upgrade documentation.";
|
||||||
|
|
||||||
Application::RequestShutdown(EXIT_FAILURE);
|
Application::Exit(EXIT_FAILURE);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String instanceName = GetInstanceName();
|
String instanceName = GetInstanceName();
|
||||||
|
|
|
@ -228,8 +228,7 @@ void IdoPgsqlConnection::Reconnect(void)
|
||||||
|
|
||||||
Log(LogCritical, "IdoPgsqlConnection", "Schema does not provide any valid version! Verify your schema installation.");
|
Log(LogCritical, "IdoPgsqlConnection", "Schema does not provide any valid version! Verify your schema installation.");
|
||||||
|
|
||||||
Application::RequestShutdown(EXIT_FAILURE);
|
Application::Exit(EXIT_FAILURE);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String version = row->Get("version");
|
String version = row->Get("version");
|
||||||
|
@ -242,8 +241,7 @@ void IdoPgsqlConnection::Reconnect(void)
|
||||||
<< "Schema version '" << version << "' does not match the required version '"
|
<< "Schema version '" << version << "' does not match the required version '"
|
||||||
<< SCHEMA_VERSION << "'! Please check the upgrade documentation.";
|
<< SCHEMA_VERSION << "'! Please check the upgrade documentation.";
|
||||||
|
|
||||||
Application::RequestShutdown(EXIT_FAILURE);
|
Application::Exit(EXIT_FAILURE);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String instanceName = GetInstanceName();
|
String instanceName = GetInstanceName();
|
||||||
|
|
|
@ -110,7 +110,7 @@ void ApiListener::Start(void)
|
||||||
if (!AddListener(GetBindHost(), GetBindPort())) {
|
if (!AddListener(GetBindHost(), GetBindPort())) {
|
||||||
Log(LogCritical, "ApiListener")
|
Log(LogCritical, "ApiListener")
|
||||||
<< "Cannot add listener on host '" << GetBindHost() << "' for port '" << GetBindPort() << "'.";
|
<< "Cannot add listener on host '" << GetBindHost() << "' for port '" << GetBindPort() << "'.";
|
||||||
Application::RequestShutdown(EXIT_FAILURE);
|
Application::Exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Timer = new Timer();
|
m_Timer = new Timer();
|
||||||
|
|
Loading…
Reference in New Issue