[icinga-checkins] icinga.org: icinga2/master: Fix deadlock in DbObject::SendVars{Config, Status}Update

git at icinga.org git at icinga.org
Tue Jul 12 11:59:04 CEST 2016


Module: icinga2
Branch: master
Commit: ea57f0045e4ade0d5dc264637eaf095a2b91e67b
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=ea57f0045e4ade0d5dc264637eaf095a2b91e67b

Author: Gunnar Beutner <gunnar.beutner at netways.de>
Date:   Tue Jul 12 11:44:36 2016 +0200

Fix deadlock in DbObject::SendVars{Config,Status}Update

fixes #12127
fixes #12085

---

 lib/db_ido/dbobject.cpp |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/lib/db_ido/dbobject.cpp b/lib/db_ido/dbobject.cpp
index 1b85b60..471bd42 100644
--- a/lib/db_ido/dbobject.cpp
+++ b/lib/db_ido/dbobject.cpp
@@ -161,6 +161,7 @@ void DbObject::SendVarsConfigUpdate(void)
 	Dictionary::Ptr vars = CompatUtility::GetCustomAttributeConfig(custom_var_object);
 
 	if (vars) {
+		std::vector<DbQuery> queries;
 		ObjectLock olock (vars);
 
 		BOOST_FOREACH(const Dictionary::Pair& kv, vars) {
@@ -196,8 +197,10 @@ void DbObject::SendVarsConfigUpdate(void)
 			query.WhereCriteria->Set("varname", kv.first);
 			query.Object = this;
 
-			OnQuery(query);
+			queries.push_back(query);
 		}
+
+		OnMultipleQueries(queries);
 	}
 }
 
@@ -213,6 +216,7 @@ void DbObject::SendVarsStatusUpdate(void)
 	Dictionary::Ptr vars = CompatUtility::GetCustomAttributeConfig(custom_var_object);
 
 	if (vars) {
+		std::vector<DbQuery> queries;
 		ObjectLock olock (vars);
 
 		BOOST_FOREACH(const Dictionary::Pair& kv, vars) {
@@ -248,8 +252,10 @@ void DbObject::SendVarsStatusUpdate(void)
 			query.WhereCriteria->Set("varname", kv.first);
 			query.Object = this;
 
-			OnQuery(query);
+			queries.push_back(query);
 		}
+
+		OnMultipleQueries(queries);
 	}
 }
 



More information about the icinga-checkins mailing list