-
-
Notifications
You must be signed in to change notification settings - Fork 461
Persistence extensions: fix potential infinite loop #5018
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
Conversation
Signed-off-by: Mark Herwege <[email protected]>
Signed-off-by: Mark Herwege <[email protected]>
|
I'd say that this is a pretty important fix, so it should get priority. |
holgerfriedrich
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
* fix potential eternal loop on empty peristence * tests Signed-off-by: Mark Herwege <[email protected]>
|
Merged an backported to 5.0.x. Not sure what to do with 4.3 - the code seems to be same there. I have not checked if tests make sense on 4.3.x. |
I doubt back porting the tests makes much sense. There had been change to the code between 4.3 and 5.0 in this area, so back porting the fix will have to be a new PR against 4.3. The offending code had been there for more than 3 years already. So, should I do it? |
With an issue like this, I'd say: absolutely. Just drop the tests and backport the fix. |
|
This pull request has been mentioned on openHAB Community. There might be relevant details there: |
|
This pull request has been mentioned on openHAB Community. There might be relevant details there: https://community.openhab.org/t/high-cpu-usage-since-upgrade-to-5-0-1/165989/31 |
|
I'll label this as backported4 although this is done via separate PR #5019 (w/o the tests introduced for 5.x). |
|
This pull request has been mentioned on openHAB Community. There might be relevant details there: |
|
This pull request has been mentioned on openHAB Community. There might be relevant details there: https://community.openhab.org/t/high-cpu-load-unresponsive-oh-since-upgrade-even-with-5-0-2/167055/1 |
If an item has no values persisted, the
lastUpdate,lastChangeandpreviousStatepersistence extensions could get into an infinite loop. This could also happen when the query to the persistence service fails when called from these extension methods, e.g. because the database is offline.Resolves openhab/openhab-addons#19313
See https://community.openhab.org/t/high-cpu-usage-since-upgrade-to-5-0-1/165989/20?u=mherwege
See https://community.openhab.org/t/high-cpu-usage-when-calling-lastupdate-on-offline-influxdb-database/166198
Also see https://community.openhab.org/t/averagesince-calculation-wrong-if-no-measurements-in-timerange-available/166177/12. This PR adds some tests that look for the described behaviour in the community post. The tests did not reveal the issue so far.
If accepted, this should be backported.
@Nadahar @jimtng FYI