Skip to content

Commit e678f09

Browse files
authored
Merge pull request #10151 from Icinga/bugfix/do-not-sync-partially-initialised-objects
IcingaDB: Don't sync partially initialised objects
2 parents 3ffec77 + 26f43b0 commit e678f09

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lib/icingadb/icingadb-objects.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,15 @@ void IcingaDB::UpdateAllConfigObjects()
286286
if (lcType != GetLowerCaseTypeNameDB(object))
287287
continue;
288288

289+
// If we encounter not yet activated objects, i.e. they are currently being loaded and are about to
290+
// be activated, but are still partially initialised, we want to exclude them from the config dump
291+
// before we end up in a nullptr deference and crash the Icinga 2 process. Should these excluded
292+
// objects later reach the activation process, they will be captured via the `OnActiveChanged` event
293+
// and processed in IcingaDB::VersionChangedHandler() as runtime updates.
294+
if (!object->IsActive()) {
295+
continue;
296+
}
297+
289298
std::vector<Dictionary::Ptr> runtimeUpdates;
290299
CreateConfigUpdate(object, lcType, hMSets, runtimeUpdates, false);
291300

0 commit comments

Comments
 (0)