Cyclic references between objects should be forbidden
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 2.2k
- Forks
- 616
- Avg merge
- 5d 6h
- Merged PRs (30d)
- 10
Description
In https://github.com/Icinga/icinga2/pull/10000#issuecomment-2411060141, @yhabteab pointed out that configurations like the following are currently accepted by Icinga 2:
object HostGroup "foo" {
groups = [ "bar" ]
}
object HostGroup "bar" {
groups = [ "foo" ]
}
object TimePeriod "included" {
excludes = ["excluded"]
ranges = { "2024-10-14" = "14:00-15:00" }
}
object TimePeriod "excluded" {
excludes = ["included"]
ranges = { "2024-10-14" = "13:00-15:00" }
}
It's questionable if there would be valid use-cases for a configuration like this. Additionally, if cyclic dependencies are created using runtime updates, these objects may fail to synchronize as it's impossible to sort them properly if there are cycles[^1].
So at the moment, DependencyGraph (not to be confused with the Dependency config object type, DependencyGraph tracks config dependencies between all objects) may contain cycles, which could also be surprising.
[^1]: However, these object will not always fail to sync. There will be a problem if it's the initial sync of the object to the destination node. If an older version object already exists there, the incoming sync could update the object and introduce the cycle though.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue points to lib/base/dependencygraph.hpp; start by reading DependencyGraph and tracing how configuration objects are ordered and synchronized. Reproduce the HostGroup and TimePeriod cycles from the report, then verify that cyclic dependencies are rejected consistently, including cycles introduced by runtime updates.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- distributed-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100