mirror of https://github.com/Icinga/icinga2.git
Merge pull request #9221 from Icinga/bugfix/processcheckresult-dependency-deadlock
Prevent deadlock in ProcessCheckResult
This commit is contained in:
commit
8e81faf3e0
|
@ -239,20 +239,6 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig
|
|||
}
|
||||
}
|
||||
|
||||
if (recovery) {
|
||||
for (auto& child : children) {
|
||||
if (child->GetProblem() && child->GetEnableActiveChecks()) {
|
||||
auto nextCheck (now + Utility::Random() % 60);
|
||||
|
||||
ObjectLock oLock (child);
|
||||
|
||||
if (nextCheck < child->GetNextCheck()) {
|
||||
child->SetNextCheck(nextCheck);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!reachable)
|
||||
SetLastStateUnreachable(cr->GetExecutionEnd());
|
||||
|
||||
|
@ -280,20 +266,6 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig
|
|||
(GetAcknowledgement() == AcknowledgementSticky && IsStateOK(new_state))) {
|
||||
ClearAcknowledgement("");
|
||||
}
|
||||
|
||||
/* reschedule direct parents */
|
||||
for (const Checkable::Ptr& parent : GetParents()) {
|
||||
if (parent.get() == this)
|
||||
continue;
|
||||
|
||||
if (!parent->GetEnableActiveChecks())
|
||||
continue;
|
||||
|
||||
if (parent->GetNextCheck() >= now + parent->GetRetryInterval()) {
|
||||
ObjectLock olock(parent);
|
||||
parent->SetNextCheck(now);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool remove_acknowledgement_comments = false;
|
||||
|
@ -415,6 +387,36 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig
|
|||
<< "% current: " << GetFlappingCurrent() << "%.";
|
||||
#endif /* I2_DEBUG */
|
||||
|
||||
if (recovery) {
|
||||
for (auto& child : children) {
|
||||
if (child->GetProblem() && child->GetEnableActiveChecks()) {
|
||||
auto nextCheck (now + Utility::Random() % 60);
|
||||
|
||||
ObjectLock oLock (child);
|
||||
|
||||
if (nextCheck < child->GetNextCheck()) {
|
||||
child->SetNextCheck(nextCheck);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (stateChange) {
|
||||
/* reschedule direct parents */
|
||||
for (const Checkable::Ptr& parent : GetParents()) {
|
||||
if (parent.get() == this)
|
||||
continue;
|
||||
|
||||
if (!parent->GetEnableActiveChecks())
|
||||
continue;
|
||||
|
||||
if (parent->GetNextCheck() >= now + parent->GetRetryInterval()) {
|
||||
ObjectLock olock(parent);
|
||||
parent->SetNextCheck(now);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
OnNewCheckResult(this, cr, origin);
|
||||
|
||||
/* signal status updates to for example db_ido */
|
||||
|
|
Loading…
Reference in New Issue