Merge pull request #10151 from Icinga/bugfix/do-not-sync-partially-initialised-objects

IcingaDB: Don't sync partially initialised objects
This commit is contained in:
Yonas Habteab 2024-09-18 15:48:42 +02:00 committed by GitHub
commit e678f0977d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 0 deletions

View File

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