-
Notifications
You must be signed in to change notification settings - Fork 580
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
Creation an object with ignore_on_error
flag set causes an infinite recursion
#8824
Comments
ping @Al2Klimov! |
If |
As I already said, the problem appears only after this fix.
|
Indeed, I don't think anyone sets the [2021-06-21 12:33:39 +0200] notice/ConfigObject: Ignoring config object 'icinga2-host' of type 'Host' due to errors: Error: Validation failed for object 'icinga2-host' of type 'Host'; Attribute 'check_command': Attribute must not be empty.
Location: in /Users/yhabteab/Workspace/icinga2/prefix/etc/icinga2/conf.d/hosts.conf: 18:1-18:42
/Users/yhabteab/Workspace/icinga2/prefix/etc/icinga2/conf.d/hosts.conf(16): */
/Users/yhabteab/Workspace/icinga2/prefix/etc/icinga2/conf.d/hosts.conf(17):
/Users/yhabteab/Workspace/icinga2/prefix/etc/icinga2/conf.d/hosts.conf(18): object Host "icinga2-host" ignore_on_error {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/Users/yhabteab/Workspace/icinga2/prefix/etc/icinga2/conf.d/hosts.conf(19): address = "localhost"
/Users/yhabteab/Workspace/icinga2/prefix/etc/icinga2/conf.d/hosts.conf(20): vars.os = "Linux"
[2021-06-21 12:33:39 +0200] notice/cli: Worker process couldn't load its config |
Then I'd say it's a problem of the fix. |
This can be also reproduced without the referenced PR. Test Config:
Result: With a snapshot package.
|
ignore_on_error
flag set causes an infinite recursion
Describe the bug
When an error is encountered while creating an object, for example due to forgetting the
check_command
attribute for a host object and havingignore_on_error
flag set, it unfortunately causes an endless recursion in ConfigItem::CommitNewItems() and finally leads Icinga2 to crash. It is normally the case that if an error occurs in ConfigItem::Commit() when evaluating or validating the config and theignore_on_error
flag is not set, immediately an error is raised but if this flag is set, anullptr
is returned instead. Since this returned value is not checked in CommitNewItems() it will always continue even though the object could not be created.And as
CommitNewItems()
calls itself recursively and the config item which could not be created has not been committed and hence is not yet a config object, it will be considered as a new object over and over again. This procedure will be repeated until it most likely ends up hitting a corrupt memory and crashing icinga2 because none of the conditions will break this infinite recursion call unless an exception is raised in theWorkQueue
.However, I'm still not sure where exactly this crash occurs, as it only happens occasionally and the
nullptr
value being returned is nowhere direferenced.The text was updated successfully, but these errors were encountered: