Rules stop executing after a while

mjcumming

      [Michael Cumming](https://community.openhab.org/u/mjcumming)




    September 27

I get the feeling that doing anything much more than if then else in a rule is asking for problems.


Visit Topic or reply to this email to respond.


In Reply To

rlkoshak

      [Rich Koshak](https://community.openhab.org/u/rlkoshak)

      Foundation member




    September 27

Maybe I’m remembering someone else I’m helping. Though with locks, let’s say you have 10 events that take place at nearly the same time and the Rule takes 20 msec to run. Then it will take 180 msec for the last event to start processing. And for 100 msec no other Rules can run. If the events keep c…


Visit Topic or reply to this email to respond.

To unsubscribe from these emails, click here.

Well, after months of running Ok (with crash plan stopped from time to time), I am now back to the issue of rules simply stopping working. No real pattern, could run for a day, or a few minutes. Now even with crasplan stopped.

None of the suggestions here have helped so far.

Anyone have any idea of how to troubleshoot this? It’s extremely frustrating. My band-aid of having a timer detect when rules stop triggering, and restart OH2 is keeping things limping along.

I have been using OH for a long time, it’s just since 2.2, now 2.3 that this problem has started.

Hey Nicholas,

i am pretty sure that there is some specific rule that causes all the mess.
At least that’s what happened to my system.
Have you tried disabling all rules and enabling them step by step to ifentify the rule that is causing the troubles?

Are all rules not working or only cron related?

I would set up a rule that creates a log entry every minute.
With this rule enabled, enable you first “real” rule and let the system run. Or maybe only enable the rule which is already your suspect.

This is very time consuming but maybe it helps narrowing it down…

It would be nice to know what the threads are doing when everyone’s rules execution stops. Maybe you can provide use with some detailed thread information next time the issue occurs?

To get the thread info you can issue the following command on the Console:

threads --monitors --locks

I’ve had a very similar problem: I’ve created a simple test rule that toggles an test-item every minute between ON and OFF. I also created a second rules that triggers on changes of this test-item and a third rule, that triggers on received updates. After some time OpenHab2 randomly stopped triggering the second and third rules: Item changed triggers and item received update triggers simply stopped triggering without any obvious reason.

After some research I found that the MySQL Persistence was causing this issue. I replaced the MySQL Persistence by MapDB Persistence and RRD4J Persistence using the Design Pattern: Group Based Persistence. Immediately after eliminating MySQL Persistence the problem was gone.

I hope this helps.

Now I’m on this train as well.

The openhab setup with rules and everything has been working fine for over a week now, maybe even two.

And now all of a sudden, yesterday, all rules stopped working - all I see is the dummy item, that’s supposed to trigger a rule, get it’s update but no rule actions…

I have 6 rules, all of which are similar in a sense that they listen to whether a dummy item received a command, and then in turn send several commands (2-4).

I have no timed triggers or anything.

Please pay a new thread and post your rules.

I’ve also run into this dreaded problem too.

It actually came up once long ago on 2.3 (i think?) and I never really resolved it.

We moved to a new house, so I started completely fresh with 2.5 where everything was great for about 5 months. Recently, I upgraded to 2.5 m2 and noticed the rules engine would periodically stop running again. Any new suggestions on how to best debug this?

Thanks!!

@roy_liao

its more efficient to start a new thread as Rich mentioned.

For a first step when you do start a new thread, this needs clarifying. I would guess that there is no actual evidence that the rules engine has “stopped”, but instead that rules that you expected to run, didn’t run?

An outline of why you expected them to run would help. Triggered by time,or by events? The events.log and perhaps openhab.log preceding the problem would be good, but you would need to say what might be missing or unexpected.

Ah, got it. Wasn’t sure what the etiquette was for this type of recurring issue. I didn’t want to needlessly create new threads for similar items. Thanks for letting me know. I’ll start a new thread.

It’s actually quite severe, at least in my case. ALL rules stop running.

Read (OH 1.x and OH 2.x Rules DSL only] Why have my Rules stopped running? Why Thread::sleep is a bad idea to see if that applies…

please link your new thread

As luck would have it, I setup a watchdog rule and I’ve been trying to collect clear logs. However, the system kindly decided to behave the last few days!

Will create a new thread once the rules stop running again and I can get some better logging in place.

1 Like

I’ve been fighting with this “rules suddenly stop working” issue for several months now as well and am becoming very frustrated and disillusioned with OpenHabian.

I set up some very simple rules in Paper UI to operate switiches that turn lights ON/OFF in my home. The rules make use of Astro Channel events such as local Sun Civil Dusk and local Sun Sunrise events to run a command that turns ON/OFF Z-Wave and Wemo Wifi Switches that are connected to lights.

I use an Aeon Labs Aeotec Z-Wave Z-Stick, Gen5 Z-Wave Plus - ZW090 and a Raspberry PI 2 and OpenHabian 4.19.42-v7+ #1219 SMP Tue May 14 21:20:58 BST 2019 armv7l. I’m running OpenHabian from an SD Card.

The rules work great for anywhere from 1 up to 3 weeks. Then they just stop working. ALL OF THEM.
At this point when I go to ssh into my OpenHabian Raspberry PI, I can’t. Paper UI is also hosed at this point. I have to reboot the Raspberry PI.

After a reboot, OpenHabian Paper UI comes back on line and I’m able to ssh in again.

However at this point the rules appear to be corrupt/broken.

If I edit the rules by making a minor change to the rule description and savie it, then manually run the rule with the “play button” icon, it appears to work again. Sometimes however, the rule while functional with the “play button” doesn’t trigger based on the Channel event or fixed time and I need to delete all the rules and recreate them again. Then things work for a while again before the entire cycle repeats.

So it appears that every couple of weeks or so OpenHabian is crashing/hanging and some sort of corruption is occurring with the rules.

This is really frustrating and I’m not sure where to start to debug the issue.

Guidance and suggestion for debugging and tracing the root cause would be appreciated.

I’m not doing anything fancy. Very simple and straight forward rules. I have seen several posts here by others experiencing what appears to be similar behavior for the rules.

Thanks in advance for your help.

…Steve

Dying SD-card maybe…
What is the age of your card ?

That suggests you are using the Experimental Rules engine. I’m not sure how robust that is.

The PaperUI Rules are labeled as Experimental for a reason. They are not super robust yet. The problem where you need to make an edit and resave the Rule is a known issue and I believe it has been fixed in the snapshots if not in 2.5 M3. If not, there is an issue open for it.

But the problem you are experiencing is more fundamental than that and isn’t directly related to your Rules. Something is crashing your whole RPi if you can’t ssh into it. The source of the problem could be a failing SD card. It could also be a memory leak in OH or something else you are running. I do know that if you try to use Grafana to create static image charts on an RPi it will consume all the memory and then crash your OH.

This is going to take some investigation and I recommend you open a new thread for that.

It’s a couple of months old. I will make an image copy on a new SD and try that to see if I can run without experiencing this issue for a longer period of time, more than 2-3 weeks.

Can you clarify what is “experimental” about the Paper UI Rules. The UI itself, or the underlying Rule engine implementation. I can see my rules in the REST API after adding them via the Paper UI, so is the Rule REST API also “experimental”? Should I be deploying my rules via the REST API? If the Paper UI and REST API are both experimental… what is the recommended way of writing/deploying rules using the “Non-Experimental” Rules interfaces/implementations?

I’m happy to open a new thread and will do that. I posted here because the rule behavior seemed similar to what I am experiencing, granted less the freezing of OpenHab and the inability to SSH in.

Would be great if someone could help me methodically diagnose this issue. I’m happy to navigate the logs, share configuration details, enable trace level debugging etc., but I need some guidance on where to start.

Thanks.

…Steve