From 36743f3100ad5f76dacb6077878ef6b9cfa20999 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Tue, 20 May 2025 13:02:26 +0200 Subject: [PATCH] Checkable#ProcessCheckResult(): discard CR or delay its producers shutdown --- lib/icinga/checkable-check.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/icinga/checkable-check.cpp b/lib/icinga/checkable-check.cpp index b2b5ca45e..2d34ec644 100644 --- a/lib/icinga/checkable-check.cpp +++ b/lib/icinga/checkable-check.cpp @@ -14,6 +14,7 @@ #include "base/convert.hpp" #include "base/utility.hpp" #include "base/context.hpp" +#include using namespace icinga; @@ -101,6 +102,7 @@ Checkable::ProcessingResult Checkable::ProcessCheckResult(const CheckResult::Ptr using Result = Checkable::ProcessingResult; VERIFY(cr); + VERIFY(producer); { ObjectLock olock(this); @@ -135,6 +137,14 @@ Checkable::ProcessingResult Checkable::ProcessCheckResult(const CheckResult::Ptr cr->SetCheckSource(command_endpoint->GetName()); } + std::shared_lock producerLock (*producer, std::try_to_lock); + + if (!producerLock) { + // Discard the check result to not delay the current reload. + // We'll re-run the check immediately after the reload. + return Result::CheckableInactive; + } + /* agent checks go through the api */ if (command_endpoint && GetExtension("agent_check")) { ApiListener::Ptr listener = ApiListener::GetInstance();