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()
|
||||
{
|
||||
if (m_FlushLogTimer)
|
||||
m_FlushLogTimer->Stop();
|
||||
m_FlushLogTimer->Stop(true);
|
||||
|
||||
if (m_Stream && m_OwnsStream)
|
||||
delete m_Stream;
|
||||
|
|
|
@ -81,7 +81,7 @@ void CheckerComponent::Stop(bool runtimeRemoved)
|
|||
m_CV.notify_all();
|
||||
}
|
||||
|
||||
m_ResultTimer->Stop();
|
||||
m_ResultTimer->Stop(true);
|
||||
m_Thread.join();
|
||||
|
||||
Log(LogInformation, "CheckerComponent")
|
||||
|
|
|
@ -82,6 +82,8 @@ void CompatLogger::Start(bool runtimeCreated)
|
|||
*/
|
||||
void CompatLogger::Stop(bool runtimeRemoved)
|
||||
{
|
||||
m_RotationTimer->Stop(true);
|
||||
|
||||
Log(LogInformation, "CompatLogger")
|
||||
<< "'" << GetName() << "' stopped.";
|
||||
|
||||
|
|
|
@ -101,7 +101,8 @@ void DbConnection::Pause()
|
|||
Log(LogInformation, "DbConnection")
|
||||
<< "Pausing IDO connection: " << GetName();
|
||||
|
||||
m_CleanUpTimer.reset();
|
||||
m_LogStatsTimer->Stop(true);
|
||||
m_CleanUpTimer->Stop(true);
|
||||
|
||||
DbQuery query1;
|
||||
query1.Table = "programstatus";
|
||||
|
|
|
@ -108,7 +108,8 @@ void IdoMysqlConnection::Pause()
|
|||
|
||||
DbConnection::Pause();
|
||||
|
||||
m_ReconnectTimer.reset();
|
||||
m_ReconnectTimer->Stop(true);
|
||||
m_TxTimer->Stop(true);
|
||||
|
||||
#ifdef I2_DEBUG /* I2_DEBUG */
|
||||
Log(LogDebug, "IdoMysqlConnection")
|
||||
|
|
|
@ -112,7 +112,8 @@ void IdoPgsqlConnection::Pause()
|
|||
{
|
||||
DbConnection::Pause();
|
||||
|
||||
m_ReconnectTimer.reset();
|
||||
m_ReconnectTimer->Stop(true);
|
||||
m_TxTimer->Stop(true);
|
||||
|
||||
Log(LogInformation, "IdoPgsqlConnection")
|
||||
<< "'" << GetName() << "' paused.";
|
||||
|
|
|
@ -195,6 +195,8 @@ void IcingaDB::Stop(bool runtimeRemoved)
|
|||
<< m_HistoryBulker.Size() << " queued history queries.";
|
||||
}
|
||||
|
||||
m_StatsTimer->Stop(true);
|
||||
|
||||
Log(LogInformation, "IcingaDB")
|
||||
<< "'" << GetName() << "' stopped.";
|
||||
|
||||
|
|
|
@ -52,6 +52,8 @@ void NotificationComponent::Start(bool runtimeCreated)
|
|||
|
||||
void NotificationComponent::Stop(bool runtimeRemoved)
|
||||
{
|
||||
m_NotificationTimer->Stop(true);
|
||||
|
||||
Log(LogInformation, "NotificationComponent")
|
||||
<< "'" << GetName() << "' stopped.";
|
||||
|
||||
|
|
|
@ -117,6 +117,8 @@ void ElasticsearchWriter::Pause()
|
|||
m_HandleStateChanges.disconnect();
|
||||
m_HandleNotifications.disconnect();
|
||||
|
||||
m_FlushTimer->Stop(true);
|
||||
|
||||
Flush();
|
||||
m_WorkQueue.Join();
|
||||
Flush();
|
||||
|
|
|
@ -112,7 +112,7 @@ void GelfWriter::Pause()
|
|||
m_HandleNotifications.disconnect();
|
||||
m_HandleStateChanges.disconnect();
|
||||
|
||||
m_ReconnectTimer.reset();
|
||||
m_ReconnectTimer->Stop(true);
|
||||
|
||||
try {
|
||||
ReconnectInternal();
|
||||
|
|
|
@ -107,7 +107,7 @@ void GraphiteWriter::Resume()
|
|||
void GraphiteWriter::Pause()
|
||||
{
|
||||
m_HandleCheckResults.disconnect();
|
||||
m_ReconnectTimer.reset();
|
||||
m_ReconnectTimer->Stop(true);
|
||||
|
||||
try {
|
||||
ReconnectInternal();
|
||||
|
|
|
@ -113,6 +113,7 @@ void InfluxdbCommonWriter::Pause()
|
|||
Log(LogDebug, GetReflectionType()->GetName())
|
||||
<< "Processing pending tasks and flushing data buffers.";
|
||||
|
||||
m_FlushTimer->Stop(true);
|
||||
m_WorkQueue.Enqueue([this]() { FlushWQ(); }, PriorityLow);
|
||||
|
||||
/* 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()
|
||||
{
|
||||
m_HandleCheckResults.disconnect();
|
||||
m_ReconnectTimer.reset();
|
||||
m_ReconnectTimer->Stop(true);
|
||||
|
||||
Log(LogInformation, "OpentsdbWriter")
|
||||
<< "'" << GetName() << "' paused.";
|
||||
|
|
|
@ -70,7 +70,7 @@ void PerfdataWriter::Resume()
|
|||
void PerfdataWriter::Pause()
|
||||
{
|
||||
m_HandleCheckResults.disconnect();
|
||||
m_RotationTimer.reset();
|
||||
m_RotationTimer->Stop(true);
|
||||
|
||||
#ifdef I2_DEBUG
|
||||
//m_HostOutputFile << "\n# Pause the feature" << "\n\n";
|
||||
|
|
|
@ -331,6 +331,13 @@ void ApiListener::RenewOwnCert()
|
|||
|
||||
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);
|
||||
|
||||
Log(LogInformation, "ApiListener")
|
||||
|
|
Loading…
Reference in New Issue