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

WIP: /var/run/icinga2/icinga2.s: reload on POST /v1/reload #7349

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Al2Klimov
Copy link
Member

@Al2Klimov Al2Klimov commented Jul 23, 2019

... and wait for the reload to complete before responding to let curl(?) block the reload command.

fixes #7301
resolves #8911
closes #8973

@Al2Klimov Al2Klimov changed the title WIP: DaemonCommand#Run(): Run HTTPd on /var/run/icinga2/icinga2.s WIP: /var/run/icinga2/icinga2.s: reload on POST /v1/reload Jul 23, 2019
@Al2Klimov
Copy link
Member Author

@dnsmichi I have something (this one) to show you and the rest of team Icinga core (one nice day).

@Al2Klimov Al2Klimov added this to the 2.13.0 milestone Nov 23, 2020
@Al2Klimov
Copy link
Member Author

@N-o-X What about this sync reload trigger as alternative to the current async one?

@Al2Klimov Al2Klimov added the needs feedback We'll only proceed once we hear from you again label Dec 15, 2020
@julianbrost julianbrost modified the milestones: 2.13.0, 2.14.0 May 31, 2021
@Al2Klimov
Copy link
Member Author

@cla-bot check

@cla-bot cla-bot bot added the cla/signed label Aug 4, 2021
@Al2Klimov Al2Klimov added the enhancement New feature or request label Aug 10, 2021
@Al2Klimov
Copy link
Member Author

Al2Klimov commented Aug 23, 2021

@julianbrost about this solution: #8973 (comment)

@Al2Klimov
Copy link
Member Author

Feedback

  • Julian
  • Noah

@N-o-X N-o-X removed their assignment Dec 6, 2021
@julianbrost julianbrost self-requested a review April 29, 2022 08:42
@julianbrost
Copy link
Contributor

I had a quick look at this to see if this could serve as basis for implementing one of the ideas I proposed in #9363, but for that, the listening socket is in the wrong process.

General impression after looking at this:

  • Current state does not fix yet what it says to fix in the PR description: systemd unit file is not updated yet, the systemd unit file isn't updated so far, but well, the description also says "WIP". Also, compared to safe-reload, no validation output seems to be returned.
  • In general, fork() not immediately followed by exec() is always tricky, just look at the amount of uninitialize/reinitialize workarounds, so I'm not sure about making the umbrella process even more complex that it already is. Are there any plans on extending the HTTP API with further commands? Otherwise, some simple file-based notification mechanism might be a better fit.

@julianbrost julianbrost removed their request for review April 29, 2022 12:59
@julianbrost julianbrost marked this pull request as draft April 29, 2022 12:59
@Al2Klimov
Copy link
Member Author

  • Also, compared to safe-reload, no validation output seems to be returned.

Shall I fix this?

@julianbrost
Copy link
Contributor

Not right now, please focus on the reviews and comments on your Icinga DB PRs first.

@Al2Klimov
Copy link
Member Author

Al2Klimov commented May 2, 2022

My question was Shall I fix this? Not Shall I fix this right now?

@julianbrost
Copy link
Contributor

Before fixing anything, we should first agree on the approach. Like if we can't come up with another useful purpose of the socket, all that extra HTTP handling might be overkill and something simpler could be done without that extra threading in the umbrella process.

@Al2Klimov
Copy link
Member Author

Overkill or not, it doesn’t reinvent the wheel and curl speaks it.

@julianbrost
Copy link
Contributor

My complaint isn't HTTP in itself but rather that in order to implement it, you have to add threads, which you have to tear down again in order to be able to fork, and then restore again.

@Al2Klimov
Copy link
Member Author

Would be not the first ones, would they?

@julianbrost julianbrost removed this from the 2.14.0 milestone Jan 12, 2023
@julianbrost
Copy link
Contributor

Given that fork() from a multi-threaded applications is problematic (that's why the current state of the PR has to tear down the threads before forking) and as the umbrella process doesn't have to (and should not) do any heavy lifting: would it be possible to just run any pending coroutines in the main loop on that thread?

Would be not the first ones, would they?

I'd rather try to get rid of any existing extra threads in the umbrella process rather than adding more.

@Al2Klimov
Copy link
Member Author

Well I could merge this new ASIO event loop with Application#RunEventLoop(). But this would make the still necessary teardown-fork(2)-setup parts even uglier. Shall I do this?

@julianbrost
Copy link
Contributor

Well the idea behind that idea was avoid having to tear down anything. So that doesn't sound like it would move into a direction I'd like to see.

@Al2Klimov
Copy link
Member Author

What about an early forked subprocess instead? Could communicate w/ umbrella via shared memory.

@Al2Klimov
Copy link
Member Author

Now as I saw #9136: What about an mmap(2)ed file in /run with some state and semaphores? This way a new CLI command icinga2 reload could communicate with the daemon w/o requiring it to have an extra thread or process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla/signed enhancement New feature or request needs feedback We'll only proceed once we hear from you again
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Defines not preserved on reload systemd: our ExecReload command doesn't wait for the reload to complete
3 participants