-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Restore on Startup not working for RRD4J with OH4.1M4 #16057
Comments
This issue has been mentioned on openHAB Community. There might be relevant details there: https://community.openhab.org/t/openhab-4-1-milestone-discussion/149502/135 |
This is finally not clear. Is the problem with rrd4j or MapDB ? |
@openhab/add-ons-maintainers : looks like a critical bug for OH 4.1. Way to reproduce it is unfortunately not clear at all IMHO. What change between M3 and M4 could have broken restore on startup feature ? |
This could also be a core issue. But I need an easy way to reproduce it. |
Sorry for the confusion. Problem is with rrd4j. Mapdb just hadn't time to collect a value on those items, so still had NULL values because rrd4j wasn't restoring. Anyway this should work to recreate.
|
Hi all I can confirm it is rrd4j. I did see this when upgrading from M3 to M4. Half of my 600 items did not restore on startup and rules did not work anymore (most probably because value was NULL). Unfortunately I don't have more details or any Logs because it was my productive system. Did immediately go back to stable 4.04 after that. M3 was stable over weeks for me. |
I will try with my usual test environment this evening: last snapshot installed from scratch on Windows, just Basic UI and rrd4j as add-ons, few items from file and a DSL rule updating item states. |
I can actually reproduce it on my production system. I'll try to have a look at it tonight or tomorrow and see if I can help. |
As I already said: it could also be a core problem, related to the refactoring in openhab/openhab-core#3889. There has always been an issue with the loading of configuration files, because there was a short time after the start of a persistence service with the default configuration applied. It could be that the PR (or some other refactoring) changed the timing and therefore the IMO the "default configuration" should be removed completely. In fact, since all persistence services are also OSGi components, the configuration should probably be set before the service is activated and then the persistence manager should request the configuration from the service. But that's not super-easy and should definitely happen after the release. |
I can explain the behavior, but I don't have a solution ATM. The case is indeed openhab/openhab-core#3889, but it's not a bug there. Before that PR no end time was set in the filter criteria when querying the most recent state. This changed because we need to get the first state before now, not the state with the biggest timestamp. There is also no begin timestamp set, and the page size is 1. Unfortunately "begin=null" and "end=null" and "pagesize=1" has a special handling in rrd4j:
because we now have an end-timestamp, the "get last value" part is no longer executed and we don't get a valid value because start=end and the last bin could be empty. |
Maybe the |
Thanks for the analysis @J-N-K, I am now also back at my keyboard. |
start == end is a valid selection, it selects exactly one bin, so as long as we know exactly what (=which point in time) we want (historicState) it's correct. The issue only occurs if we don't know what the last valid bin is (restoreOnStartup requires "last valid value", not "value from last bin"). This special case was handled by start=null,end=null,pageSize=1. That's why I suggested to handle start=null,end=now,pageSize=1 the same way. |
Ok, got it. So we have to identify if |
#16059 seems to nicely address the issue. |
Expected Behavior
States restored
Current Behavior
This is mentioned in the community under 4.1 Milestones. Appears to be about three confirmations. Unrestored items are NULL and (for me) about a half a dozen rules bomb.
Also as noted in the forum, the items that are NULL are items created to count reports and lights (not connected to any binding). All my MQTT items were "restored", but I think that just happens when Mqtt is connected.
Possible Solution
Wild guess is that some checking protocol was introduced between M3 and M4 and because not all items (Dates & Images) are managed and the new check fails and the whole restore on startup process stops?.
Steps to Reproduce (for Bugs)
Context
Rules bomb on startup
Your Environment
Release = Raspbian GNU/Linux 11 (bullseye)
Kernel = Linux 6.1.21-v8+
Platform = Raspberry Pi 4 Model B Rev 1.1
Uptime = 61 day(s). 3:4:28
CPU Usage = 0.75% avg over 4 cpu(s) (4 core(s) x 1 socket(s))
CPU Load = 1m: 0.01, 5m: 0.03, 15m: 0.05
Memory = Free: 0.30GB (17%), Used: 1.54GB (83%), Total: 1.85GB
Swap = Free: 1.92GB (96%), Used: 0.07GB (4%), Total: 1.99GB
Root = Free: 41.24GB (74%), Used: 14.14GB (26%), Total: 58.38GB
Updates = 0 apt updates available.
Processes = 154 running processes of 32768 maximum processes
The text was updated successfully, but these errors were encountered: