From 4371649064afc5002e8953f1b8ca5a9bc35c8db3 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Fri, 8 Mar 2013 16:32:29 +0100 Subject: [PATCH] Fix deadlock when adding/removing acknowledgements. --- lib/icinga/externalcommandprocessor.cpp | 27 ++++--------------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/lib/icinga/externalcommandprocessor.cpp b/lib/icinga/externalcommandprocessor.cpp index c5b7fd7cf..d8dce8dd6 100644 --- a/lib/icinga/externalcommandprocessor.cpp +++ b/lib/icinga/externalcommandprocessor.cpp @@ -479,11 +479,7 @@ void ExternalCommandProcessor::AcknowledgeSvcProblem(double, const vectorGetName() + "'"); - { - ObjectLock olock(service); - - service->AcknowledgeProblem(sticky ? AcknowledgementSticky : AcknowledgementNormal); - } + service->AcknowledgeProblem(sticky ? AcknowledgementSticky : AcknowledgementNormal); } void ExternalCommandProcessor::AcknowledgeSvcProblemExpire(double, const vector& arguments) @@ -501,11 +497,7 @@ void ExternalCommandProcessor::AcknowledgeSvcProblemExpire(double, const vector< Logger::Write(LogInformation, "icinga", "Setting timed acknowledgement for service '" + service->GetName() + "'"); - { - ObjectLock olock(service); - - service->AcknowledgeProblem(sticky ? AcknowledgementSticky : AcknowledgementNormal, timestamp); - } + service->AcknowledgeProblem(sticky ? AcknowledgementSticky : AcknowledgementNormal, timestamp); } void ExternalCommandProcessor::RemoveSvcAcknowledgement(double, const vector& arguments) @@ -517,11 +509,7 @@ void ExternalCommandProcessor::RemoveSvcAcknowledgement(double, const vectorGetName() + "'"); - { - ObjectLock olock(service); - - service->ClearAcknowledgement(); - } + service->ClearAcknowledgement(); } void ExternalCommandProcessor::AcknowledgeHostProblem(double, const vector& arguments) @@ -536,8 +524,6 @@ void ExternalCommandProcessor::AcknowledgeHostProblem(double, const vectorGetName() + "'"); Service::Ptr service = host->GetHostCheckService(); if (service) { - ObjectLock olock(service); - if (service->GetState() == StateOK) BOOST_THROW_EXCEPTION(invalid_argument("The host '" + arguments[0] + "' is OK.")); @@ -558,8 +544,6 @@ void ExternalCommandProcessor::AcknowledgeHostProblemExpire(double, const vector Logger::Write(LogInformation, "icinga", "Setting timed acknowledgement for host '" + host->GetName() + "'"); Service::Ptr service = host->GetHostCheckService(); if (service) { - ObjectLock olock(service); - if (service->GetState() == StateOK) BOOST_THROW_EXCEPTION(invalid_argument("The host '" + arguments[0] + "' is OK.")); @@ -576,11 +560,8 @@ void ExternalCommandProcessor::RemoveHostAcknowledgement(double, const vectorGetName() + "'"); Service::Ptr service = host->GetHostCheckService(); - if (service) { - ObjectLock olock(service); - + if (service) service->ClearAcknowledgement(); - } } void ExternalCommandProcessor::EnableHostgroupSvcChecks(double, const vector& arguments)