openhab / openhab-addons

Add-ons for openHAB
https://www.openhab.org/
Eclipse Public License 2.0
1.88k stars 3.59k forks source link

[rrd4j] Sometimes fails to save updates on everyUpdate for Group Items #10234

Open rkoshak opened 3 years ago

rkoshak commented 3 years ago

Expected Behavior

The old behavior was when you had in rrd4j.persist

    * : strategy = everyMinute, everyUpdate

Group Items, even those without a type and aggregation function would be ignored.

Current Behavior

In OH 3 that appears to no longer be the case. Occasionally on one of these Group Items the value appears to be attempted to be saved. However the following will appear in the logs:

2021-02-25 07:16:43.446 [ERROR] [d4j.internal.RRD4jPersistenceService] - Could not create rrd4j database file '/openhab/userdata/persistence/rrd4j/ServiceStatuses.rrd': null

Querying the DB through the REST API shows that the value is indeed not saved (I searched for the milliseconds 446 in the results and did not find it to occur in the last three digits of the timestamp), but everyMinute values are saved.

Possible Solution

A possible workaround I'm testing is changing the strategy to everyChange instead of everyUpdate. I'm testing this out right now but might take a day before I'm convinced it worked. If this is a threading synchronization issue, which my brief look at the code indicates could be the case, that should avoid bombarding the rrd4j add-on with a bunch of updates from a Group Item.

Steps to Reproduce (for Bugs)

  1. Create a strategy like the one created above
  2. Create a Group with a type and aggregation function
  3. Give the Group enough members that change often enough to cause updates on the Group. I can't say how many, some of my Groups have 2 members, others have 30 and I see the error on them all occasionally).

Context

I don't think that the above strategy is unreasonable. If it is reasonable then there shouldn't be this error. If it is unreasonable that needs to be in the docs. Now that I'm looking at this I probably should have been using everyChange anyway all along.

Your Environment

dandjo commented 2 years ago

According to this discussion zram could be the problem.

https://community.openhab.org/t/could-not-create-rrd4j-database-file-error-in-oh3/113025/20

lsiepel commented 2 months ago

As this issue is three years old, is this still relevant? Don't think that i can add anything to fix this issue, but would be nice to see this updated (or closed).