-
Notifications
You must be signed in to change notification settings - Fork 578
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
TimePeriod: consult GetIncludes() and GetExcludes() in IsInside(), not UpdateRegion() #7855
base: master
Are you sure you want to change the base?
Conversation
@cla-bot check |
And maybe it also fixes #8741. |
I'm very interested for solving #8741. Thatswhy I try to bring focus back on this issue. I have some news which maybe would help for further debug: This bug affected me already since icinga2-2.12.3-1.el7. |
Test cases for #7398 Config
Before
After
Now, comment out the
|
810df35
to
cef46e5
Compare
Running tests for #8741: http://10.27.0.228/icingaweb2/dashboard |
ref/IP/44756 |
The code change looks non-trivial and the referenced issue is quite lengty, so please add a summary of the problem and how this is fixed by this PR to the description. |
That comment only contains a test. Or do you consider the example configuration to be a sufficient description of the problem? Apart from that, I can't really follow that test either. Let's consider the time periods on 2022-06-22 (which indeed was a Wednesday) at 09:57:51:
And according to the "Before" log, a notification gets sent, which looks correct to me. Now the "After" log is from 10:33:58, that means the For the second "After" test, the time period So there are only correct cases in this test, so it doesn't demonstrate any change. Apart from that, the test is strange because there was a time period transition between the times the old and the new version was tested. |
And from pure code design PoV?
|
Intermediate resultThe only thing changed here -TimePeriod- doesn’t have a getcurrent/next/whatever interface based on the segments, so only IsInside() matters. IMAO no harm possibility. |
@yhabteab Btw. no idea why you and me got different test results with notifications and checks, both(!) use only IsInside(). Maybe yet another rebase will fix your tests... |
cef46e5
to
50cd84e
Compare
@davixd Would you like to test whether this fix solves your specific problem? Here you are your Icinga version plus my three commits: |
@Al2Klimov |
@Al2Klimov What about demonstrating the issue/fix on the TimePeriod level as we discussed (preferably as a unit test)? |
I honestly -but abjectly- tried. This is hard-to-catch fish.
And you said yourself that it's unlikely the customer's problem. So let's cancel our attempt and demount the fishing rod. |
the packages seems not to be updatable with the official repo from Icinga2 for CentOS7:
Installed on my CentOS 7.9 dev system is:
Any suggestions? |
What's your current Icinga 2 version? |
icinga2-2.13.7-1.el7.x86_64 |
At best you put all these in a new, persistent directory. Then run createrepo /new/persistent/directory. Finally create /etc/yum.repos.d/NAME_IS_UP_TO_YOU.repo like this:
Now you should be able to upgrade just the icinga2 packages as usual and to undo the upgrade by yum history undo last before you disable that new repo again (if you wish). |
@Al2Klimov Your packages are based on 2.13.3, I don't see why that downgrade should be intended here (and that's why yum rejects them). |
What is the code block with the test case trying to show? Does that test pass both with and without this PR? |
@julianbrost @Al2Klimov @julianbrost
So now I can test it with Icinga2 2.13.3+3. I be back with the results. |
C'mon! I've built fresh 2.13.7+3 packages for you: #7855 (comment) And yes, the unit test result (pass IIRC) doesn’t change with this PR. |
I'm back with the results. Unfortunately #7855 / 2.13.7+3 does not fix #8741. My tests and results: Test1:
Test2:
Test3:
Test4:
Test5:
My config: timeperiods.conf:
users.conf:
If you need further tests, please do not hesitate to ask. I will help as I can to pin point this bug. Best regards |
Updated OP with more relation to ref/IP/44756 |
@davixd 💡 Please could you re-try your test cases with copied&pasted TimePeriods under different names and after installing my packages and restarting Icinga, so that the old TPs' states (state file) don’t affect them? |
|
fixesdoesn't fix #7398Edit
The solution
2/3 commits just remove unused methods. 769de8d is your friend.
Instead of (error prone) merging the timeperiod's own calculated segments (e.g. 1640000000 - 1670000000) with the ones of the included/excluded timeperiods (e.g. 1660000000 - 1690000000) for using the merge result in one IsInside() call, this PR keeps each timeperiod's own calculated segments isolated from each other.
Due to this IsInside() has to call included/excluded timeperiods' IsInside() now.
The problemIMAO Yonas already summarised the problem clearly in #7855 (comment) .Edit II
"error prone" means that the order of periodically updated timeperiods matter. I.e. ideally the timeperiods used for including/excluding are updated first, then the ones refering to them. In the opposite case you have a problem as the computed ranges of parent_TP are merged with the computed ranges of child_TP before the latter are updated.