Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IcingaDB: Don't sync partially initialised objects #10151

Merged
merged 1 commit into from
Sep 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions lib/icingadb/icingadb-objects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Loading