mirror of https://github.com/Icinga/icinga2.git
Explicitly stop started timers and wait for them
before permitting their parent objects' destruction. For the cases where the handlers have raw pointers to these objects.
This commit is contained in:
parent
c41e5fd05d
commit
ba7102cae3
|
@ -28,7 +28,7 @@ void StreamLogger::Stop(bool runtimeRemoved)
|
||||||
StreamLogger::~StreamLogger()
|
StreamLogger::~StreamLogger()
|
||||||
{
|
{
|
||||||
if (m_FlushLogTimer)
|
if (m_FlushLogTimer)
|
||||||
m_FlushLogTimer->Stop();
|
m_FlushLogTimer->Stop(true);
|
||||||
|
|
||||||
if (m_Stream && m_OwnsStream)
|
if (m_Stream && m_OwnsStream)
|
||||||
delete m_Stream;
|
delete m_Stream;
|
||||||
|
|
|
@ -81,7 +81,7 @@ void CheckerComponent::Stop(bool runtimeRemoved)
|
||||||
m_CV.notify_all();
|
m_CV.notify_all();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_ResultTimer->Stop();
|
m_ResultTimer->Stop(true);
|
||||||
m_Thread.join();
|
m_Thread.join();
|
||||||
|
|
||||||
Log(LogInformation, "CheckerComponent")
|
Log(LogInformation, "CheckerComponent")
|
||||||
|
|
|
@ -82,6 +82,8 @@ void CompatLogger::Start(bool runtimeCreated)
|
||||||
*/
|
*/
|
||||||
void CompatLogger::Stop(bool runtimeRemoved)
|
void CompatLogger::Stop(bool runtimeRemoved)
|
||||||
{
|
{
|
||||||
|
m_RotationTimer->Stop(true);
|
||||||
|
|
||||||
Log(LogInformation, "CompatLogger")
|
Log(LogInformation, "CompatLogger")
|
||||||
<< "'" << GetName() << "' stopped.";
|
<< "'" << GetName() << "' stopped.";
|
||||||
|
|
||||||
|
|
|
@ -101,7 +101,8 @@ void DbConnection::Pause()
|
||||||
Log(LogInformation, "DbConnection")
|
Log(LogInformation, "DbConnection")
|
||||||
<< "Pausing IDO connection: " << GetName();
|
<< "Pausing IDO connection: " << GetName();
|
||||||
|
|
||||||
m_CleanUpTimer.reset();
|
m_LogStatsTimer->Stop(true);
|
||||||
|
m_CleanUpTimer->Stop(true);
|
||||||
|
|
||||||
DbQuery query1;
|
DbQuery query1;
|
||||||
query1.Table = "programstatus";
|
query1.Table = "programstatus";
|
||||||
|
|
|
@ -108,7 +108,8 @@ void IdoMysqlConnection::Pause()
|
||||||
|
|
||||||
DbConnection::Pause();
|
DbConnection::Pause();
|
||||||
|
|
||||||
m_ReconnectTimer.reset();
|
m_ReconnectTimer->Stop(true);
|
||||||
|
m_TxTimer->Stop(true);
|
||||||
|
|
||||||
#ifdef I2_DEBUG /* I2_DEBUG */
|
#ifdef I2_DEBUG /* I2_DEBUG */
|
||||||
Log(LogDebug, "IdoMysqlConnection")
|
Log(LogDebug, "IdoMysqlConnection")
|
||||||
|
|
|
@ -112,7 +112,8 @@ void IdoPgsqlConnection::Pause()
|
||||||
{
|
{
|
||||||
DbConnection::Pause();
|
DbConnection::Pause();
|
||||||
|
|
||||||
m_ReconnectTimer.reset();
|
m_ReconnectTimer->Stop(true);
|
||||||
|
m_TxTimer->Stop(true);
|
||||||
|
|
||||||
Log(LogInformation, "IdoPgsqlConnection")
|
Log(LogInformation, "IdoPgsqlConnection")
|
||||||
<< "'" << GetName() << "' paused.";
|
<< "'" << GetName() << "' paused.";
|
||||||
|
|
|
@ -195,6 +195,8 @@ void IcingaDB::Stop(bool runtimeRemoved)
|
||||||
<< m_HistoryBulker.Size() << " queued history queries.";
|
<< m_HistoryBulker.Size() << " queued history queries.";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_StatsTimer->Stop(true);
|
||||||
|
|
||||||
Log(LogInformation, "IcingaDB")
|
Log(LogInformation, "IcingaDB")
|
||||||
<< "'" << GetName() << "' stopped.";
|
<< "'" << GetName() << "' stopped.";
|
||||||
|
|
||||||
|
|
|
@ -52,6 +52,8 @@ void NotificationComponent::Start(bool runtimeCreated)
|
||||||
|
|
||||||
void NotificationComponent::Stop(bool runtimeRemoved)
|
void NotificationComponent::Stop(bool runtimeRemoved)
|
||||||
{
|
{
|
||||||
|
m_NotificationTimer->Stop(true);
|
||||||
|
|
||||||
Log(LogInformation, "NotificationComponent")
|
Log(LogInformation, "NotificationComponent")
|
||||||
<< "'" << GetName() << "' stopped.";
|
<< "'" << GetName() << "' stopped.";
|
||||||
|
|
||||||
|
|
|
@ -117,6 +117,8 @@ void ElasticsearchWriter::Pause()
|
||||||
m_HandleStateChanges.disconnect();
|
m_HandleStateChanges.disconnect();
|
||||||
m_HandleNotifications.disconnect();
|
m_HandleNotifications.disconnect();
|
||||||
|
|
||||||
|
m_FlushTimer->Stop(true);
|
||||||
|
|
||||||
Flush();
|
Flush();
|
||||||
m_WorkQueue.Join();
|
m_WorkQueue.Join();
|
||||||
Flush();
|
Flush();
|
||||||
|
|
|
@ -112,7 +112,7 @@ void GelfWriter::Pause()
|
||||||
m_HandleNotifications.disconnect();
|
m_HandleNotifications.disconnect();
|
||||||
m_HandleStateChanges.disconnect();
|
m_HandleStateChanges.disconnect();
|
||||||
|
|
||||||
m_ReconnectTimer.reset();
|
m_ReconnectTimer->Stop(true);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ReconnectInternal();
|
ReconnectInternal();
|
||||||
|
|
|
@ -107,7 +107,7 @@ void GraphiteWriter::Resume()
|
||||||
void GraphiteWriter::Pause()
|
void GraphiteWriter::Pause()
|
||||||
{
|
{
|
||||||
m_HandleCheckResults.disconnect();
|
m_HandleCheckResults.disconnect();
|
||||||
m_ReconnectTimer.reset();
|
m_ReconnectTimer->Stop(true);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ReconnectInternal();
|
ReconnectInternal();
|
||||||
|
|
|
@ -113,6 +113,7 @@ void InfluxdbCommonWriter::Pause()
|
||||||
Log(LogDebug, GetReflectionType()->GetName())
|
Log(LogDebug, GetReflectionType()->GetName())
|
||||||
<< "Processing pending tasks and flushing data buffers.";
|
<< "Processing pending tasks and flushing data buffers.";
|
||||||
|
|
||||||
|
m_FlushTimer->Stop(true);
|
||||||
m_WorkQueue.Enqueue([this]() { FlushWQ(); }, PriorityLow);
|
m_WorkQueue.Enqueue([this]() { FlushWQ(); }, PriorityLow);
|
||||||
|
|
||||||
/* Wait for the flush to complete, implicitly waits for all WQ tasks enqueued prior to pausing. */
|
/* Wait for the flush to complete, implicitly waits for all WQ tasks enqueued prior to pausing. */
|
||||||
|
|
|
@ -92,7 +92,7 @@ void OpenTsdbWriter::Resume()
|
||||||
void OpenTsdbWriter::Pause()
|
void OpenTsdbWriter::Pause()
|
||||||
{
|
{
|
||||||
m_HandleCheckResults.disconnect();
|
m_HandleCheckResults.disconnect();
|
||||||
m_ReconnectTimer.reset();
|
m_ReconnectTimer->Stop(true);
|
||||||
|
|
||||||
Log(LogInformation, "OpentsdbWriter")
|
Log(LogInformation, "OpentsdbWriter")
|
||||||
<< "'" << GetName() << "' paused.";
|
<< "'" << GetName() << "' paused.";
|
||||||
|
|
|
@ -70,7 +70,7 @@ void PerfdataWriter::Resume()
|
||||||
void PerfdataWriter::Pause()
|
void PerfdataWriter::Pause()
|
||||||
{
|
{
|
||||||
m_HandleCheckResults.disconnect();
|
m_HandleCheckResults.disconnect();
|
||||||
m_RotationTimer.reset();
|
m_RotationTimer->Stop(true);
|
||||||
|
|
||||||
#ifdef I2_DEBUG
|
#ifdef I2_DEBUG
|
||||||
//m_HostOutputFile << "\n# Pause the feature" << "\n\n";
|
//m_HostOutputFile << "\n# Pause the feature" << "\n\n";
|
||||||
|
|
|
@ -331,6 +331,13 @@ void ApiListener::RenewOwnCert()
|
||||||
|
|
||||||
void ApiListener::Stop(bool runtimeDeleted)
|
void ApiListener::Stop(bool runtimeDeleted)
|
||||||
{
|
{
|
||||||
|
m_ApiPackageIntegrityTimer->Stop(true);
|
||||||
|
m_CleanupCertificateRequestsTimer->Stop(true);
|
||||||
|
m_AuthorityTimer->Stop(true);
|
||||||
|
m_ReconnectTimer->Stop(true);
|
||||||
|
m_Timer->Stop(true);
|
||||||
|
m_RenewOwnCertTimer->Stop(true);
|
||||||
|
|
||||||
ObjectImpl<ApiListener>::Stop(runtimeDeleted);
|
ObjectImpl<ApiListener>::Stop(runtimeDeleted);
|
||||||
|
|
||||||
Log(LogInformation, "ApiListener")
|
Log(LogInformation, "ApiListener")
|
||||||
|
|
Loading…
Reference in New Issue