Several rules stop working after a day

Sadly I have a make or break problem with OpenHab: a number of rules that worked fine before, stop running after about a day.
Oddly it is not allmy rules, e.g. a rule based on sunset/sundown is running fine whereas some rules with a Cron statement do not.
Also a rule to keep track of how long my frontdoor is open is affected, but a rule registering what time it was opened and a rule telling meit is opened are not affected.

I know there have been issues with cron statements in rules, but that has been corrected in the most recent version and it is not just the cron statement rules that have issues.
So just to summarize, after a fresh start all these rules work perfectly, but say after a day a number of them stop working.
I dont think there is a need to show any of the affected rules because I dont think there us anything wrong with the rule, but it affects rules as simple as:

rule "Staircase light on"
when
    Time cron "0 0 23 1/1 * ? *" //every day at 23 hr
then
    logInfo("Staircase light on", "Staircase light on")
    TrapLight.sendCommand(ON)
    sendMail("xxxxxx@gmail.com", "traplichtrules", "Light on at 11")
end

The Logfiles do not give any useable info.
Obviously this is kind of a serious problem for me as no matter how much I love openhab, if the rules are unreliable, it becomes useless.
Seen several related postings but none led to any conclusive answer/solution

Using a Pi3 with Jessie. Install done with Openhabian. OpenHab version 2.2.0-1.

Anybody any idea?

How long has OH been running on this Pi?
I had a very similar problem and a change of SD card was the solution.

  • Buy a new good SD card
  • Clean openhabian install
  • Copy the conf files. DO NOT restore a back up, you will only be copying the faults
1 Like

Thanks, not sure how long, but certainly not more than 4 months
getting a new sd card is something I have done very often already and it may be the solution. In the past it has solved other ‘vague’ problems
Have always used brand cards from e.g. Kingston or Samsung.
There seems to be a difference of opinion on sd wear in openhab,but I may have to try it (again) if anything else fails.
I do not immediately see how with a faulty sd card just some rules stop predictably after a day, but work immediately again after a restart, but I may need to give it a try

One possible theory would be that when the cron engine reschedules the trigger for the next day it writes something to file. If the SD card is failing that write may not actually get made or becomes corrupted. When your system first starts up it reads the bits that are actually on the SD card which, though really old, are at least valid and let your Rules trigger. So the Rules work the first day and then fail after that.

I’m not saying this is happening or even how it even works, but it is one way in which a failing SD card can cause weird behavior.

Personally, I recommend against using SD cards for running OH, particularly if you are also running persistence on that same SD card, NOT because SD cards can fail, but because when they do fail they do so silently. You just start seeing weird behavior and you don’t really know whether the problem is the SD card unless you re-setup everything on a new SD card and the problem goes away.

At least with SSDs or HDDs, you have SMART and other built-in monitors to tell you when the device is starting to fail.

I’m not saying that you have a failing SD card, though that isn’t outside the realm of the possible. But whenever we see “it works for awhile and then stops” the problem is usually either:

  1. you have long running rules that use up all of the execution threads
  2. you have a failing SD card

Based on your description I don’t think you have 1 so that leaves 2.

1 Like

Thanks for explaining Rich.
I immediately believe it could be a failing SD card, just didn’t understand the mechanism in this.
The only persistence I have is the temperature
However, not the first time getting a new card would solve a vague problem.
I 'll give it a try. Happy already there is a possible solution looming
Maybe I better get an SSD or HDD.

Will report back!

Any updates? I am seeing a similar problem, but I’m running on a server with an SSD - my rules just silently stop triggering after a few days also (but cron based rules continue to work).

Did you ever solve this?

nope not yet, currently I just have a cronjob restarting openhab once a day, but obviously that is not an ideal solution