mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-22 21:24:41 +02:00
Fix 100% CPU usage issue and incorrect pending checks accounting in CheckerComponent::CheckThreadProc
fixes #11806
This commit is contained in:
parent
bb69540b32
commit
b99b373b6f
@ -121,7 +121,10 @@ void CheckerComponent::CheckThreadProc(void)
|
|||||||
|
|
||||||
double wait = checkable->GetNextCheck() - Utility::GetTime();
|
double wait = checkable->GetNextCheck() - Utility::GetTime();
|
||||||
|
|
||||||
if (wait > 0 || Checkable::GetPendingChecks() >= GetConcurrentChecks()) {
|
if (Checkable::GetPendingChecks() >= GetConcurrentChecks())
|
||||||
|
wait = 0.5;
|
||||||
|
|
||||||
|
if (wait > 0) {
|
||||||
/* Wait for the next check. */
|
/* Wait for the next check. */
|
||||||
m_CV.timed_wait(lock, boost::posix_time::milliseconds(wait * 1000));
|
m_CV.timed_wait(lock, boost::posix_time::milliseconds(wait * 1000));
|
||||||
|
|
||||||
|
@ -52,11 +52,12 @@ void PluginCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckRes
|
|||||||
resolvers.push_back(std::make_pair("command", commandObj));
|
resolvers.push_back(std::make_pair("command", commandObj));
|
||||||
resolvers.push_back(std::make_pair("icinga", IcingaApplication::GetInstance()));
|
resolvers.push_back(std::make_pair("icinga", IcingaApplication::GetInstance()));
|
||||||
|
|
||||||
Checkable::IncreasePendingChecks();
|
|
||||||
|
|
||||||
PluginUtility::ExecuteCommand(commandObj, checkable, checkable->GetLastCheckResult(),
|
PluginUtility::ExecuteCommand(commandObj, checkable, checkable->GetLastCheckResult(),
|
||||||
resolvers, resolvedMacros, useResolvedMacros,
|
resolvers, resolvedMacros, useResolvedMacros,
|
||||||
boost::bind(&PluginCheckTask::ProcessFinishedHandler, checkable, cr, _1, _2));
|
boost::bind(&PluginCheckTask::ProcessFinishedHandler, checkable, cr, _1, _2));
|
||||||
|
|
||||||
|
if (!resolvedMacros || useResolvedMacros)
|
||||||
|
Checkable::IncreasePendingChecks();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PluginCheckTask::ProcessFinishedHandler(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr, const Value& commandLine, const ProcessResult& pr)
|
void PluginCheckTask::ProcessFinishedHandler(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr, const Value& commandLine, const ProcessResult& pr)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user