File based rules not running (maybe eventbus issue)

  • Platform information:
    • Hardware: x64 (Virtualized)
    • OS: Ubuntu 24.04.01
    • Java Runtime Environment: openjdk 17.0.12
    • openHAB version: 4.2.2
  • Issue of the topic: File based rules are not working after updating to 4.2.2.

I believe this may be a similar issue to this thread and maybe this one also. My rules are all file based and were working without issue until I updated to 4.2.2 on 10/16/2024. My rules completely stopped working. According to openhab.log, rule files appear to be loaded without error.

I disabled all my rule files by adding the extension “.no” after .rules and created 1 test file (test.rules) containing:

rule "System started file test.rules"
when
	System started
then
	logInfo("Logger", "System started has triggered in test.rules")
end

In the log file, I get (and only this):

2024-10-28 12:12:42.775 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'test.rules'

I created a very similar rule in the UI and it works when run via the UI but does not work when an event based trigger is used (i.e. item state changed).

Also, my event log has been empty since the upgrade to 4.2.2. Manual control of items (via Habpanel) and feedback are working correctly even though events are not registered in the logs. I think this may actually be the source of the issue. Maybe the rules are loaded, but without an events being logged, they will never trigger.

So, I really don’t understand what is going on here as the permissions seem correct.

This is the entirety of what I did to get it working. Very strange.

$ systemctl stop openhab.service
$ ls -l /var/log/openhab/events.log
-rw-r--r-- 1 openhab openhab      0 Oct 16 06:36 events.log
$ sudo rm /var/log/openhab/events.log
$ systemctl start openhab.service

<-- Wait a few minutes -->

$ ls -l /var/log/openhab/events.log
-rw-r--r-- 1 openhab openhab 138449 Oct 28 14:14 /var/log/openhab/events.log

I’m returning my rules to service, so hopefully no issues there.

1 Like

Could be out of space on the file system. If there wasn’t room to log out events maybe that blocked them from proceeding to the file based rules?

It’s the only thing that even sort of makes sense that you can at least check. Beyond that all I can do is say I’m glad you got it working.

@rlkoshak I am at a loss as well. From what I can see, OH rolls the log every time it starts or when the active file hits 16MB. Based on file sizes of the compressed logs, it looks like it rolled and failed to start back up on 10/12. I did updates on 10/16, but didn’t realize stuff wasn’t working until today. Doesn’t look like a disk space issue (and there would be many other symptoms I would think):

$ df -h
Filesystem                         Size  Used Avail Use% Mounted on
tmpfs                              197M  4.7M  193M   3% /run
/dev/mapper/ubuntu--vg-ubuntu--lv   51G  6.1G   43G  13% /
tmpfs                              984M     0  984M   0% /dev/shm
tmpfs                              5.0M  4.0K  5.0M   1% /run/lock
/dev/sda2                          2.0G  182M  1.7G  10% /boot
tmpfs                              197M   16K  197M   1% /run/user/1000

I also thought there might be a filesystem lock on it, but I didn’t find any logs indicating that. I also think a system restart (which I tried) would have released the lock. I had no issues deleting the file as root. I should have tried as openhab to see if something else would have happened.

I also noticed that the UI debugger event viewer was working as expected. Again, I think whatever was going on with the file was the issue.

Oh well. Maybe this will help someone else.

So these are DSL rules?
I remember something about groovy rules not loading in the milestone discussion thread maybe report there