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

Cluster config file sync broken in master #9639

Closed
julianbrost opened this issue Jan 25, 2023 · 10 comments · Fixed by #9648
Closed

Cluster config file sync broken in master #9639

julianbrost opened this issue Jan 25, 2023 · 10 comments · Fixed by #9648
Assignees
Labels
area/configuration DSL, parser, compiler, error handling area/distributed Distributed monitoring (master, satellites, clients) blocker Blocks a release or needs immediate attention
Milestone

Comments

@julianbrost
Copy link
Contributor

24b57f0 from #9627 broke the cluster config file sync: It uses --define System.ZonesStageVarDir=... which can no longer be modified as that namespace was already frozen at that point. Can be easily reproduced:

$ icinga2 daemon -C --define System.ZonesStageVarDir=/var/empty
[2023-01-25 10:58:30 +0000] critical/Application: Error: Namespace is read-only and must not be modified.


Additional information is available in '/var/log/icinga2/crash/report.1674644310.455242'
Aborted

May affect other uses of --define/-D. We have to check if there are other valid uses that were broken by this and how we can fix this. In general, forbidding something like -DTypes.Host=lol (which could be done before but will break basically every config) doesn't sound like a bad idea to me, but even then, it shouldn't write a crash dump.

@julianbrost julianbrost added area/configuration DSL, parser, compiler, error handling blocker Blocks a release or needs immediate attention labels Jan 25, 2023
@julianbrost julianbrost added this to the 2.14.0 milestone Jan 25, 2023
@julianbrost julianbrost self-assigned this Jan 25, 2023
@julianbrost
Copy link
Contributor Author

@julianbrost
Copy link
Contributor Author

Idea 1: Use Internal.ZonesStageVarDir instead of System.ZonesStageVarDir and don't freeze the Internal namespace. The attribute isn't properly documented (it shows up in a log message once) and users really shouldn't set this. Also, Internal shouldn't be on any frequent code path, so there should be no performance penalty (alternatively, it could be frozen after evaluating --define).

Idea 2 (optional, in addition): Don't expose Internal to user configuration, i.e. remove it from the globals namespace after running internal DSL snippets and evaluating --define. It's internal, so users shouldn't interact with it, so why expose it in the first place.

@julianbrost julianbrost added the area/distributed Distributed monitoring (master, satellites, clients) label Feb 1, 2023
@Al2Klimov
Copy link
Member

We can’t do this. There are legit post-start users of globals.Internal, see grep -rnFe 'ScriptGlobal::Get("Internal", &Empty)'.

@julianbrost
Copy link
Contributor Author

But then don't have to access this through globals. They should be just fine if they can access that namespace object using some other reference.

@Al2Klimov
Copy link
Member

What’s our benefit?

@julianbrost
Copy link
Contributor Author

User configuration should not interact with Internal, so why expose it at all?

@Al2Klimov
Copy link
Member

This is our biggest "benefit"? So we're basically breaking the Director for... nothing? No, thanks. Once the Director doesn't rely on this: maybe.

@Al2Klimov
Copy link
Member

@julianbrost
Copy link
Contributor Author

Once the Director doesn't rely on this: maybe.

It is only used in a function that's labeled:

Note: this is for testing purposes only, NOT production-ready

And the only use of that function is guarded by an $this->hasExperimental('live-creation').

So I wouldn't exactly call this "breaking the Director".

Also, Internal.run_with_activation_context is a function intended for use in the config snippets that are run by Icinga 2 itself in the early initialization process. I don't know what happens or might go wrong if that's used in another way later. If there was a valid use for this, there should be a proper API for this.

@julianbrost
Copy link
Contributor Author

Since this issue was mainly about another problem and is closed now, I've created #9651. We should continue any discussion over there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/configuration DSL, parser, compiler, error handling area/distributed Distributed monitoring (master, satellites, clients) blocker Blocks a release or needs immediate attention
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants