Openhab 4.0.x rules need a lot of memory

Sorry, for a consistent view we need these information from the same time. Just to avoid that recently parts of oh have been swapped.

  • htop screenshot from the top of the screen and where we can see the memory usage of OH (or VM thread :slight_smile: )
  • swapon -s
  • smem -t -p

I have a question as I haven’t found information about this.
Is your system a migrated installation from Buster to Bullseye ?
In case it is was that a 32 bit Buster installation ?
In case it was what is the output of command: uname -a after this migration / now ?

Its Bullseye and yes its migrated from Buster to Bullseye.

Linux openhabian 6.1.43-v7+ #1669 SMP Thu Aug  3 16:23:38 BST 2023 armv7l GNU/Linux
No LSB modules are available.
Distributor ID:	Raspbian
Description:	Raspbian GNU/Linux 11 (bullseye)
Release:	11
Codename:	bullseye
1 Like

This can cause issues as well, so would be worth to try with a clean bullseye installation.

Sure that is a good point. Now i will wait what we get with the commands for swap. Before I start with a fresh install… And all guys here gave me so many hints. I will post this here and then I can decide what I do as next. But at the moment swap isn’t high to collect information’s.

I think you have a few bindings installed in the addons directory. Did you make sure with their maintainers that all of them are working with OH4?
See here

grafik

The denon binding doesn’t work for me at the moment and I removed that file. The maintainer is informed. The other things are in their flow I hope.

In the meanwhile I will say thank you to all this people here that help and support me. Thanks for your time. :slight_smile:

1 Like

I developed a rule and now the rule will not execute

The i try to connect again and swap is up

Filename				Type		Size	Used	Priority
/var/swap                              	file    	1890300	933876	-2

sudo smem -t -p
  PID User     Command                         Swap      USS      PSS      RSS 
  393 avahi    avahi-daemon: chroot helper    0.01%    0.00%    0.00%    0.03% 
27519 frontail tail -n 200 -F /var/log/ope    0.01%    0.00%    0.00%    0.04% 
 5060 pi       sh -c node index.js            0.00%    0.00%    0.00%    0.04% 
  685 root     /bin/login -f                  0.03%    0.00%    0.00%    0.05% 
 2162 root     sshd: pi [priv]                0.05%    0.00%    0.00%    0.06% 
  562 root     sshd: /usr/sbin/sshd -D [li    0.03%    0.00%    0.00%    0.06% 
 7905 www-data /usr/sbin/apache2 -k start     0.39%    0.00%    0.00%    0.06% 
 8357 www-data /usr/sbin/apache2 -k start     0.39%    0.00%    0.00%    0.06% 
 8408 www-data /usr/sbin/apache2 -k start     0.39%    0.00%    0.00%    0.06% 
 8438 www-data /usr/sbin/apache2 -k start     0.39%    0.00%    0.00%    0.06% 
 8499 www-data /usr/sbin/apache2 -k start     0.39%    0.00%    0.00%    0.06% 
 8572 www-data /usr/sbin/apache2 -k start     0.39%    0.00%    0.00%    0.06% 
31262 www-data /usr/sbin/apache2 -k start     0.39%    0.00%    0.00%    0.06% 
31300 www-data /usr/sbin/apache2 -k start     0.39%    0.00%    0.00%    0.06% 
 8599 www-data /usr/sbin/apache2 -k start     0.38%    0.00%    0.00%    0.06% 
  949 pi       -bash                          0.05%    0.00%    0.00%    0.05% 
 8285 www-data /usr/sbin/apache2 -k start     0.48%    0.00%    0.00%    0.06% 
  430 root     /usr/libexec/bluetooth/blue    0.04%    0.00%    0.00%    0.06% 
  541 root     /usr/bin/python3 /usr/share    0.28%    0.00%    0.00%    0.07% 
  397 root     /usr/libexec/polkitd --no-d    0.03%    0.00%    0.00%    0.07% 
  418 nobody   /usr/sbin/thd --triggers /e    0.01%    0.00%    0.00%    0.05% 
  490 root     /usr/sbin/ModemManager         0.07%    0.00%    0.00%    0.07% 
  890 root     /usr/sbin/smbd --foreground    0.16%    0.00%    0.00%    0.08% 
  931 pi       (sd-pam)                       0.11%    0.00%    0.00%    0.06% 
26437 root     /usr/sbin/apache2 -k start     0.38%    0.00%    0.00%    0.07% 
  847 root     /usr/sbin/smbd --foreground    0.16%    0.00%    0.01%    0.09% 
  930 pi       /lib/systemd/systemd --user    0.05%    0.00%    0.01%    0.09% 
  879 root     /usr/sbin/smbd --foreground    0.14%    0.00%    0.01%    0.08% 
  876 root     /usr/sbin/smbd --foreground    0.14%    0.00%    0.01%    0.09% 
  459 root     /usr/sbin/rngd -r /dev/hwrn    0.00%    0.01%    0.01%    0.06% 
  382 root     /usr/sbin/cron -f              0.01%    0.01%    0.01%    0.07% 
22460 root     /usr/libexec/packagekitd       0.10%    0.01%    0.02%    0.09% 
  343 systemd-timesync /lib/systemd/systemd-timesy    0.03%    0.01%    0.02%    0.12% 
  414 root     /lib/systemd/systemd-logind    0.03%    0.02%    0.04%    0.13% 
 2169 pi       sshd: pi@pts/0                 0.04%    0.03%    0.04%    0.09% 
  381 avahi    avahi-daemon: running [open    0.01%    0.04%    0.04%    0.10% 
  163 root     /lib/systemd/systemd-udevd     0.08%    0.05%    0.05%    0.10% 
  678 root     /usr/sbin/nmbd --foreground    0.10%    0.04%    0.05%    0.15% 
  407 root     /usr/sbin/rsyslogd -n -iNON    0.05%    0.06%    0.06%    0.12% 
  383 messagebus /usr/bin/dbus-daemon --syst    0.02%    0.06%    0.07%    0.14% 
 5035 pi       npm start                      0.66%    0.00%    0.10%    0.34% 
 1047 mosquitto /usr/sbin/mosquitto -c /etc    0.07%    0.11%    0.11%    0.17% 
27398 frontail node /usr/lib/node_modules/    0.73%    0.00%    0.12%    0.39% 
    1 root     /sbin/init                     0.09%    0.11%    0.12%    0.21% 
 2170 pi       -bash                          0.02%    0.16%    0.16%    0.24% 
  423 root     /sbin/wpa_supplicant -u -s     0.02%    0.19%    0.20%    0.29% 
10240 root     /usr/sbin/smbd --foreground    0.12%    0.03%    0.23%    0.78% 
10243 root     /usr/sbin/smbd --foreground    0.13%    0.03%    0.23%    0.79% 
11420 root     /usr/sbin/smbd --foreground    0.14%    0.04%    0.25%    0.81% 
15371 root     sudo smem -t -p                0.00%    0.19%    0.25%    0.43% 
 1011 pi       htop -u openhab                0.03%    0.33%    0.33%    0.39% 
  384 root     /usr/sbin/NetworkManager --    0.05%    0.56%    0.57%    0.67% 
  139 root     /lib/systemd/systemd-journa    0.02%    0.62%    0.65%    0.77% 
15372 root     /usr/bin/python3 /usr/bin/s    0.00%    1.00%    1.04%    1.18% 
  680 influxdb /usr/bin/influxd -config /e    0.77%    3.08%    3.08%    3.08% 
  971 grafana  /usr/share/grafana/bin/graf    1.04%    4.55%    4.55%    4.59% 
 5061 pi       node index.js                  1.85%    5.70%    5.82%    6.09% 
27391 openhab  /usr/bin/java -XX:-UsePerfD   24.42%   61.09%   61.09%   61.15% 
-------------------------------------------------------------------------------
   58 12                                     36.35%   78.14%   79.39%   85.33%

Ok, this means that OH consumes 660MB + 430MB = 1GB, if it is technically correct to simply add physical and swapped memory.
My system which is by far less complex (9 bindings, no persistence, no grafana, etc) requires 640MB.
Not sure if this difference justifies extra 450MB of memory on your system. I assume, it does not.

I guess you already considered setting up a fresh system. If you flash a new openhabian directly to your SDD (not SD and then moving system root to SDD…) and copy your backup to /boot/initial.zip then it is just a matter of 5-10 minutes until your system is back again.

What do you meed with system root? Then only openhab is transferred. But what is with all other things? Grafana, InfluxDB, z2m, Broker apache2 … I must transfer it also and setup this systems.

I will see, don’t have time to do this maybe next weekend.

In the old days Pi did not support SDDs, just SD and system root could be moved to an SDD.
If your current system has no SD card at all, fine,
I haven‘t used InfluxDB but I think it is included in oh backup script.

EDIT:
Z2M, InfluxDB/Grafana and Mosquitto can be installed directly from menu if you are using openhabian. Just out of curiosity, are you using openhabian?

No. Both are external third party tools and not included as part of the OH backup script. openHABian has a number of backup and recovery approaches that deal with the whole filesystem. But there is no script that backups up anything from third party services like InfluxDB, zigbee2mqtt, or even Mosquitto.

If so since it’s running on an SSD it’s an unsupported configuration.

1 Like

I think it would be a good idea.

I could add the backup-routine for zigbee2mqtt into the openhabian-backup.
@mstormi : What do you think? Would you accept a PR for this?

And a remark @Wikibear: For me the title (Openhab 4.0.1 unstable) is misleading and a bit unfair. I would suggest that it is changed to something that better describes the situation.

I work on this issue and try some Configs. Switch off rules or Bindings. But it need it’s time. I don’t have a eureka moment at the moment.

I can change to what you want.

Hmm, it does not fit the concept.
System level backup/restore is part of openHABian, but application level really isn’t, not even for openHAB itself (openhab-cli does that but it’s part of openhab-distro not openHABian).
For sake of being coherent, b&r would need to be done for any 3rd party software including say InfluxDB, and we’re already lacking contributors to be proficient in maintaining those.

For the time being I’d like to have install(), setup() and remove() implemented with every 3rd party sw (at least with every new one).
If you provide backup() and restore() as a PR as well I wouldn’t mind, we could include it in the 50 menu.
But as said it’s not coherent and there’s litte hope we ever get this fully implemented so I’m no fan of that idea.

@Oliver2 I have a question. Are you use Blockly for your rules and how many rules do you have?

I am using UI based JS scripts. 20 rules.

Yes that is the point we can’t compare our systems. I have 94 rules in use. I switch them all of and openhab runs stable. Now we have to points… First point is, that Openhab needs more RAM for so many rules or I have a rule, that eat memory.
After a restart of Openhab I can see if a rule is triggered the first time and RAM increase then. I hope at the end, that there is a rule that makes problems, with timer or what ever.

OK now i’m confused. Without rule it’s look like this:

With one rule totally simple if a string is bar switch light off or on. It’s look like this:

Now next rule with time of day design pattern and some other things. Also without timer but check time now:

So that are only two blockly rules. And if i have more then 90 rules, for me it’s clear that the RAM is to less. Now the big question is, I’m wrong here? Did we have a RAM problem with Blockly rules or is this totally normal and i must buy me really a new Pi?

This are both rules:

configuration: {}
triggers:
  - id: "1"
    configuration:
      itemName: AquarienTime
    type: core.ItemStateChangeTrigger
conditions: []
actions:
  - inputs: {}
    id: "2"
    configuration:
      blockSource: <xml xmlns="https://developers.google.com/blockly/xml"><block
        type="controls_if" id="TElJ.S=4u~z0M9CWbgyZ" x="314" y="139"><mutation
        else="1"></mutation><value name="IF0"><block type="logic_compare"
        id="2!Pk_UGZPwejfl:,SXqW"><field name="OP">EQ</field><value
        name="A"><block type="oh_getitem_state" id="~$ty|i-/#pw~cd{a`acr"><value
        name="itemName"><shadow type="oh_item"
        id="q+x`vThw~SIkdrI8C@#}"><mutation itemName="AquarienTime"
        itemLabel="AquarienTime"></mutation><field
        name="itemName">AquarienTime</field></shadow></value></block></value><value
        name="B"><block type="text" id="Qi+zNyR#xUV$S0mI$*7x"><field
        name="TEXT">DAY</field></block></value></block></value><statement
        name="DO0"><block type="oh_event" id="uKk1ZlA==^HS;+D(MyG?"><field
        name="eventType">sendCommand</field><value name="value"><shadow
        type="text" id="54XU35o-|t]VOj@0oRUf"><field
        name="TEXT">ON</field></shadow></value><value name="itemName"><shadow
        type="oh_item" id="WGzdOTmTmlv_RrEBn+Ui"><mutation itemName="AquaLights"
        itemLabel="AquaLights"></mutation><field
        name="itemName">AquaLights</field></shadow></value></block></statement><statement
        name="ELSE"><block type="oh_event" id="#sk{K7-793`LbH6W|s:e"><field
        name="eventType">sendCommand</field><value name="value"><shadow
        type="text" id="QHF3m{j*`rLqy1Y=pu.I"><field
        name="TEXT">OFF</field></shadow></value><value name="itemName"><shadow
        type="oh_item" id="Z2pHbQn85wQxta6fG7Qt"><mutation itemName="AquaLights"
        itemLabel="AquaLights"></mutation><field
        name="itemName">AquaLights</field></shadow></value></block></statement></block></xml>
      type: application/javascript
      script: |
        if (items.getItem('AquarienTime').state == 'DAY') {
          items.getItem('AquaLights').sendCommand('ON');
        } else {
          items.getItem('AquaLights').sendCommand('OFF');
        }
    type: script.ScriptAction
configuration: {}
triggers:
  - id: "1"
    configuration:
      thingUID: astro:sun:local
      event: START
      channelUID: astro:sun:local:rise#event
    type: core.ChannelEventTrigger
  - id: "2"
    configuration:
      thingUID: astro:sun:local
      event: START
      channelUID: astro:sun:local:set#event
    type: core.ChannelEventTrigger
  - id: "4"
    configuration:
      cronExpression: 0 0/55 * * * ? *
    type: timer.GenericCronTrigger
conditions: []
actions:
  - inputs: {}
    id: "3"
    configuration:
      blockSource: <xml
        xmlns="https://developers.google.com/blockly/xml"><variables><variable
        id="ahcWmb?33vK44T3rEJnb">weekend</variable><variable
        id="!WiKPFYO^,hhen_ef)AB">dayAqua</variable><variable
        id="0@Yj|RJN]A[x{$f[TDEP">nightAqua</variable><variable
        id="LC5fL$)/7wd[)qTcC}!l">premorning</variable><variable
        id="A)H|1}[=EM_l)v$B975s">morning</variable><variable
        id="q7mI9!s.5{Bt$7`Pi}n6">day</variable><variable
        id="ucR5#`a*$i3Kn`L+y~WJ">prenight</variable><variable
        id="6++x3!~GO6)sH)jhiX;_">night</variable></variables><block
        type="variables_set" id="he(.v7`?FYL.CH@VwL+D" x="418" y="156"><field
        name="VAR" id="ahcWmb?33vK44T3rEJnb">weekend</field><value
        name="VALUE"><block type="oh_ephemeris_check"
        id="(l+TLWgTtfXidiL{_L;;"><field name="checkType">weekend</field><value
        name="dayInfo"><shadow type="oh_dayoffset_today"
        id="QoTQGR%=J|O:21n]*{!w"></shadow></value></block></value><next><block
        type="variables_set" id="%lf@=yE.C|F*fymF$Qj]"><field name="VAR"
        id="!WiKPFYO^,hhen_ef)AB">dayAqua</field><value name="VALUE"><block
        type="oh_zdt_amend" id="z?WDic%jF6HfOx!THKte"><mutation
        items="3"></mutation><field name="operation">with</field><value
        name="baseZdt"><shadow type="oh_zdt" id="SsP!J.U[H]DH(O:9t!=8"><field
        name="day">2022-09-25</field></shadow><block type="oh_zdt_now"
        id="qn(hxPI@U*g*6tfX3U1H"></block></value><value name="ADD0"><block
        type="oh_zdt_temporal_unit" id="`/a}*.~MdZfvy48tu)6E"><mutation
        blockType="3"></mutation><field
        name="value">9</field></block></value><value name="ADD1"><block
        type="oh_zdt_temporal_unit" id="4K]I+w;H/`%{MWn6uN|-"><mutation
        blockType="4"></mutation><field
        name="value">0</field></block></value><value name="ADD2"><block
        type="oh_zdt_temporal_unit" id="vmzUh~ex02Kth*/}sVs|"><mutation
        blockType="5"></mutation><field
        name="value">0</field></block></value></block></value><next><block
        type="variables_set" id="q?$dj$|e/IR!#u1jo;t("><field name="VAR"
        id="0@Yj|RJN]A[x{$f[TDEP">nightAqua</field><value name="VALUE"><block
        type="oh_zdt_amend" id="#I/v3]d:ik*inxu{*bd0"><mutation
        items="3"></mutation><field name="operation">with</field><value
        name="baseZdt"><shadow type="oh_zdt" id="xbR,*al]IG]tH^=!Zy]s"><field
        name="day">2022-09-25</field></shadow><block type="oh_zdt_now"
        id="lLfzVU,g(j+a3H96jRiz"></block></value><value name="ADD0"><block
        type="oh_zdt_temporal_unit" id="d}?0_?qp1pOCd5o@g%1U"><mutation
        blockType="3"></mutation><field
        name="value">21</field></block></value><value name="ADD1"><block
        type="oh_zdt_temporal_unit" id="=3[NA0vL?e(T74=*`R}@"><mutation
        blockType="4"></mutation><field
        name="value">0</field></block></value><value name="ADD2"><block
        type="oh_zdt_temporal_unit" id="W3zO8EF4x:pJno/WOyq@"><mutation
        blockType="5"></mutation><field
        name="value">0</field></block></value></block></value><next><block
        type="variables_set" id="(9.S8^@!D(0JHj7SrY~l"><field name="VAR"
        id="LC5fL$)/7wd[)qTcC}!l">premorning</field><value name="VALUE"><block
        type="oh_zdt_amend" id="gz7b}TCP0sh21DeQ`_j="><mutation
        items="3"></mutation><field name="operation">with</field><value
        name="baseZdt"><shadow type="oh_zdt" id=".9yfh(#9=bR0EZL?ssZ{"><field
        name="day">2022-09-25</field></shadow><block type="oh_zdt_now"
        id="9+[VnXkZK8,B,h3;*J)q"></block></value><value name="ADD0"><block
        type="oh_zdt_temporal_unit" id="RnVzJy+}#8f?W.QLD4;V"><mutation
        blockType="3"></mutation><field
        name="value">5</field></block></value><value name="ADD1"><block
        type="oh_zdt_temporal_unit" id="e^UcPU)YYqjrngh6-W]h"><mutation
        blockType="4"></mutation><field
        name="value">0</field></block></value><value name="ADD2"><block
        type="oh_zdt_temporal_unit" id=";UTkO(*guB5-WCFNWTJ!"><mutation
        blockType="5"></mutation><field
        name="value">0</field></block></value></block></value><next><block
        type="variables_set" id="MNg%r3C-r5t_r7JYe(I:"><field name="VAR"
        id="A)H|1}[=EM_l)v$B975s">morning</field><value name="VALUE"><block
        type="oh_zdt_amend" id="SS?pbJ@;0H#Ksc@+!snR"><mutation
        items="3"></mutation><field name="operation">with</field><value
        name="baseZdt"><shadow type="oh_zdt" id="B|kijg(v$8;][WUHyyT-"><field
        name="day">2022-09-25</field></shadow><block type="oh_zdt_now"
        id="QdweAp{+_p6)Y7x1m,{{"></block></value><value name="ADD0"><block
        type="oh_zdt_temporal_unit" id="xwT]IteX`j){%83AQR5,"><mutation
        blockType="3"></mutation><field
        name="value">6</field></block></value><value name="ADD1"><block
        type="oh_zdt_temporal_unit" id="-nRJ`%;Q@-V0YmPf#(GI"><mutation
        blockType="4"></mutation><field
        name="value">0</field></block></value><value name="ADD2"><block
        type="oh_zdt_temporal_unit" id="}$XlodNbaT:aF/G-@hA6"><mutation
        blockType="5"></mutation><field
        name="value">0</field></block></value></block></value><next><block
        type="variables_set" id="zl8`PXi@4?W:H:}V7_YU"><field name="VAR"
        id="q7mI9!s.5{Bt$7`Pi}n6">day</field><value name="VALUE"><block
        type="oh_zdt_amend" id="!+`UMWxQ_G?As}hxx0kL"><mutation
        items="3"></mutation><field name="operation">with</field><value
        name="baseZdt"><shadow type="oh_zdt" id="xkRJ7(k:p%@E3`h@|9hI"><field
        name="day">2022-09-25</field></shadow><block type="oh_zdt_now"
        id=":,O|^_-s8/(f(Jhx);9s"></block></value><value name="ADD0"><block
        type="oh_zdt_temporal_unit" id="Wb?KF8FDGD?aWN[Rs%0A"><mutation
        blockType="3"></mutation><field
        name="value">8</field></block></value><value name="ADD1"><block
        type="oh_zdt_temporal_unit" id="UWmQY3Jit`|l1Fh=j/(M"><mutation
        blockType="4"></mutation><field
        name="value">0</field></block></value><value name="ADD2"><block
        type="oh_zdt_temporal_unit" id="a|2p8?~LXqV!:z#X)GaX"><mutation
        blockType="5"></mutation><field
        name="value">0</field></block></value></block></value><next><block
        type="variables_set" id="-;RzL|Qn)95jSLcL+OjA"><field name="VAR"
        id="ucR5#`a*$i3Kn`L+y~WJ">prenight</field><value name="VALUE"><block
        type="oh_zdt_amend" id="2L8r933%!aJL9qo0liL+"><mutation
        items="3"></mutation><field name="operation">with</field><value
        name="baseZdt"><shadow type="oh_zdt" id="*7._TA[z%{.a6}h{MR$;"><field
        name="day">2022-09-25</field></shadow><block type="oh_zdt_now"
        id="!rS5?o^LuH9f?ZaQf^H1"></block></value><value name="ADD0"><block
        type="oh_zdt_temporal_unit" id=",7u`l_xnEDUP!?oOTn/."><mutation
        blockType="3"></mutation><field
        name="value">20</field></block></value><value name="ADD1"><block
        type="oh_zdt_temporal_unit" id="r[aSIVmj/=pATg~=fg(P"><mutation
        blockType="4"></mutation><field
        name="value">0</field></block></value><value name="ADD2"><block
        type="oh_zdt_temporal_unit" id="Cw[^Raty1+Po@IMG(ZSZ"><mutation
        blockType="5"></mutation><field
        name="value">0</field></block></value></block></value><next><block
        type="variables_set" id="qgAOSkw#j]D7:|#]?5)n"><field name="VAR"
        id="6++x3!~GO6)sH)jhiX;_">night</field><value name="VALUE"><block
        type="oh_zdt_amend" id="AprqB]B-imn-sD@y|I~4"><mutation
        items="3"></mutation><field name="operation">with</field><value
        name="baseZdt"><shadow type="oh_zdt" id="[~Xp!.71A-PQOQ$5c:q~"><field
        name="day">2022-09-25</field></shadow><block type="oh_zdt_now"
        id="i/@_tx$aQDo~#|qG#hlu"></block></value><value name="ADD0"><block
        type="oh_zdt_temporal_unit" id="b1Hb:FzcS|AN0HE6[p6K"><mutation
        blockType="3"></mutation><field
        name="value">22</field></block></value><value name="ADD1"><block
        type="oh_zdt_temporal_unit" id="HqpUvlIGmr*=#8E0_qSC"><mutation
        blockType="4"></mutation><field
        name="value">0</field></block></value><value name="ADD2"><block
        type="oh_zdt_temporal_unit" id="g5H8Oqaqz3*-~Rr$p~80"><mutation
        blockType="5"></mutation><field
        name="value">0</field></block></value></block></value><next><block
        type="controls_if" id="~!df)Sv9;Otr2?ZgKh{="><mutation
        else="1"></mutation><value name="IF0"><block type="logic_compare"
        id="vC3QVQn5jJzUt={o{8lu"><field name="OP">EQ</field><value
        name="A"><block type="variables_get" id=";Ra]sv_[{*9P|}iIr,a]"><field
        name="VAR"
        id="ahcWmb?33vK44T3rEJnb">weekend</field></block></value><value
        name="B"><block type="logic_boolean" id="RUh=(~Q(S!2;aOc.oPW#"><field
        name="BOOL">TRUE</field></block></value></block></value><statement
        name="DO0"><block type="oh_event" id="Su,Ng?CI)yn2FE9Q/pW,"><field
        name="eventType">sendCommand</field><value name="value"><shadow
        type="text" id="3{[XKcit?}^2YIMc@/IG"><field
        name="TEXT">ON</field></shadow></value><value name="itemName"><shadow
        type="oh_item" id="x*BXN;.mXGlf?F*L[H_m"><mutation
        itemName="WeekendTime" itemLabel="WeekendTime"></mutation><field
        name="itemName">WeekendTime</field></shadow></value></block></statement><statement
        name="ELSE"><block type="oh_event" id="SJW}gsn)TWPqC0j=eJnC"><field
        name="eventType">sendCommand</field><value name="value"><shadow
        type="text" id="%.-#hku[q6JsknC3sui~"><field
        name="TEXT">OFF</field></shadow></value><value name="itemName"><shadow
        type="oh_item" id="tX_;%lwd,2!t4sbwd(s)"><mutation
        itemName="WeekendTime" itemLabel="WeekendTime"></mutation><field
        name="itemName">WeekendTime</field></shadow></value></block></statement><next><block
        type="controls_if" id=";TWPG;azPGa(,0Zur2)R"><mutation
        else="1"></mutation><value name="IF0"><block type="logic_operation"
        id="~T6wkqbI}.I+8n,LAKp5"><field name="OP">AND</field><value
        name="A"><block type="logic_compare" id="jEh()8)ee^A0nm;M]Y[B"><field
        name="OP">GT</field><value name="A"><block type="oh_zdt_now"
        id="(^kASSV~Y-[]?%;a,.zg"></block></value><value name="B"><block
        type="oh_zdt_fromText" id="^g0l;2fv]aK~WG^Ln,Zj"><value
        name="day"><shadow type="text" id="nYI?NgGS5sY%j|{f`+qa"><field
        name="TEXT">2023-08-17</field></shadow><block type="oh_getitem_state"
        id="GAzq^B%0A/Fo4PTz;mKc"><value name="itemName"><shadow type="oh_item"
        id="valEc|0RuRWRSoG~F(sS"><mutation itemName="MyItem"
        itemLabel="MyItem"></mutation><field
        name="itemName">MyItem</field></shadow><block type="oh_item"
        id="._CDW}l5exwzKiJu*=1e"><mutation itemName="SonnenaufgangStart"
        itemLabel="SonnenaufgangStart"></mutation><field
        name="itemName">SonnenaufgangStart</field></block></value></block></value></block></value></block></value><value
        name="B"><block type="logic_compare" id="4XhGOY[_?5[@LMpfygNd"><field
        name="OP">LT</field><value name="A"><block type="oh_zdt_now"
        id="{@?F[y!yHyfkF65wR$yO"></block></value><value name="B"><block
        type="oh_zdt_fromText" id="HY,rOtvG:7wKZHBE^Fpt"><value
        name="day"><shadow type="text" id="L?|Ylj|Q3tp{W,@l)JqM"><field
        name="TEXT">2023-08-17</field></shadow><block type="oh_getitem_state"
        id="xDT[G!9$E3dxK%-B/EzW"><value name="itemName"><shadow type="oh_item"
        id="gtmGh[7Q8m!ymOR9B~CA"><mutation itemName="MyItem"
        itemLabel="MyItem"></mutation><field
        name="itemName">MyItem</field></shadow><block type="oh_item"
        id=".]Z0RGKJl8RE=#{dm.X/"><mutation itemName="SonnenuntergangStart"
        itemLabel="SonnenuntergangStart"></mutation><field
        name="itemName">SonnenuntergangStart</field></block></value></block></value></block></value></block></value></block></value><statement
        name="DO0"><block type="oh_event" id="-BBSa/|;k;9^%V7GDhVE"><field
        name="eventType">sendCommand</field><value name="value"><shadow
        type="text" id="JD1+Hsy59|`APf~nsVFW"><field
        name="TEXT">ON</field></shadow></value><value name="itemName"><shadow
        type="oh_item" id="tJ`M)jg_6-wUg4[t:/V7"><mutation itemName="DayTime"
        itemLabel="DayTime"></mutation><field
        name="itemName">DayTime</field></shadow></value></block></statement><statement
        name="ELSE"><block type="oh_event" id="gvSv`GPKd5j$lZ,IGytc"><field
        name="eventType">sendCommand</field><value name="value"><shadow
        type="text" id="*_p8A4}[L_$XCPv|C)}A"><field
        name="TEXT">OFF</field></shadow></value><value name="itemName"><shadow
        type="oh_item" id="S{*C+;.GY@op=45226|F"><mutation itemName="DayTime"
        itemLabel="DayTime"></mutation><field
        name="itemName">DayTime</field></shadow></value></block></statement><next><block
        type="controls_if" id="etb;~xx/S`/KA]:A?{S%"><mutation
        else="1"></mutation><value name="IF0"><block type="logic_operation"
        id="^t1`]?Xi^}U#A9(jw=Oj"><field name="OP">AND</field><value
        name="A"><block type="logic_compare" id="y/rYlI$,K}2P0aF^m#N|"><field
        name="OP">GT</field><value name="A"><block type="oh_zdt_now"
        id="{#yn~~H3C2(*M{E+`ain"></block></value><value name="B"><block
        type="variables_get" id=":579jq#X)^`P{j#|:zO:"><field name="VAR"
        id="!WiKPFYO^,hhen_ef)AB">dayAqua</field></block></value></block></value><value
        name="B"><block type="logic_compare" id="masM5jnQ;gTWm^:g^;`C"><field
        name="OP">LT</field><value name="A"><block type="oh_zdt_now"
        id="~B73y])HOeEOp/B3CqMZ"></block></value><value name="B"><block
        type="variables_get" id=".4)5)CR%RZOz5IU%x6N6"><field name="VAR"
        id="0@Yj|RJN]A[x{$f[TDEP">nightAqua</field></block></value></block></value></block></value><statement
        name="DO0"><block type="oh_event" id=",m;0iiLIz0#j$B$Cc~px"><field
        name="eventType">sendCommand</field><value name="value"><shadow
        type="text" id="a(w0hiQV]5~4ANg9({+m"><field
        name="TEXT">DAY</field></shadow></value><value name="itemName"><shadow
        type="oh_item" id="?@@[cgC1?XOn~*E)zA0/"><mutation
        itemName="AquarienTime" itemLabel="AquarienTime"></mutation><field
        name="itemName">AquarienTime</field></shadow></value></block></statement><statement
        name="ELSE"><block type="oh_event" id="IMQ-z.v?|WwO_=EiqO[C"><field
        name="eventType">sendCommand</field><value name="value"><shadow
        type="text" id="Fj~:4]Zw@g,|=03uuMt("><field
        name="TEXT">NIGHT</field></shadow></value><value name="itemName"><shadow
        type="oh_item" id=")xp75:1I/]9q6Pj$d7n;"><mutation
        itemName="AquarienTime" itemLabel="AquarienTime"></mutation><field
        name="itemName">AquarienTime</field></shadow></value></block></statement><next><block
        type="controls_if" id="w_uMQv0XuX9B[j;~vy;m"><value name="IF0"><block
        type="logic_operation" id="rV1APvnV;P9)ldH3t|8o"><field
        name="OP">AND</field><value name="A"><block type="logic_compare"
        id="i~sytU=F98`0li]QGD/h"><field name="OP">GT</field><value
        name="A"><block type="oh_zdt_now"
        id="Lp}ZM*le-+GZ!$+d})a9"></block></value><value name="B"><block
        type="variables_get" id="^36OCUQq@@p*g)X7iTht"><field name="VAR"
        id="LC5fL$)/7wd[)qTcC}!l">premorning</field></block></value></block></value><value
        name="B"><block type="logic_compare" id="Q{-0:yfw`v7%0PR),8@+"><field
        name="OP">LT</field><value name="A"><block type="oh_zdt_now"
        id="uY1$|Ya6d8fWx9Ik^Jn6"></block></value><value name="B"><block
        type="variables_get" id="sdBdz*b%@K?id:?X+5hV"><field name="VAR"
        id="A)H|1}[=EM_l)v$B975s">morning</field></block></value></block></value></block></value><statement
        name="DO0"><block type="oh_event" id="M*qpk-E`nzh92y]K+6fE"><field
        name="eventType">sendCommand</field><value name="value"><shadow
        type="text" id="jM*MfRzb;0GEE:b}CjDQ"><field
        name="TEXT">PREMORNING</field></shadow></value><value
        name="itemName"><shadow type="oh_item"
        id="~U+XzS],58,-~g+bT){+"><mutation itemName="TimeOfDay"
        itemLabel="TimeOfDay"></mutation><field
        name="itemName">TimeOfDay</field></shadow></value></block></statement><next><block
        type="controls_if" id="/hn]B2kGYf{dwhrWg(I["><value name="IF0"><block
        type="logic_operation" id="^B#.K-A2R0C8V-^u$7!G"><field
        name="OP">AND</field><value name="A"><block type="logic_compare"
        id="5`m0e`A=#5n5G%9dl/Yi"><field name="OP">GT</field><value
        name="A"><block type="oh_zdt_now"
        id="1|0Y=RR:WpVh5;oMNRLZ"></block></value><value name="B"><block
        type="variables_get" id="$eFrx7mNK!-0UyTMm]ul"><field name="VAR"
        id="A)H|1}[=EM_l)v$B975s">morning</field></block></value></block></value><value
        name="B"><block type="logic_compare" id="GwPC(.C9mD:=Hgfr%9-r"><field
        name="OP">LT</field><value name="A"><block type="oh_zdt_now"
        id="pb8#eZcf;ziCk0HLg|s9"></block></value><value name="B"><block
        type="variables_get" id="@c:[pz!!-apG2a@-wKG]"><field name="VAR"
        id="q7mI9!s.5{Bt$7`Pi}n6">day</field></block></value></block></value></block></value><statement
        name="DO0"><block type="oh_event" id="St7G3pm-bx{Um=L-lR64"><field
        name="eventType">sendCommand</field><value name="value"><shadow
        type="text" id="%d))B]LnwLj9Pls%2/(R"><field
        name="TEXT">MORNING</field></shadow></value><value
        name="itemName"><shadow type="oh_item"
        id="7+CiQ5~6`6oX!M@OgL]-"><mutation itemName="TimeOfDay"
        itemLabel="TimeOfDay"></mutation><field
        name="itemName">TimeOfDay</field></shadow></value></block></statement><next><block
        type="controls_if" id="Y:CUg1t5B`?RCy+R0g0d"><value name="IF0"><block
        type="logic_operation" id="5GU6WV!)x;0c$T_E2[_l"><field
        name="OP">AND</field><value name="A"><block type="logic_compare"
        id="hM_)%vyF;o;[0~vi3n.m"><field name="OP">GT</field><value
        name="A"><block type="oh_zdt_now"
        id="Qrhdlf)$oy4DfS?++EPa"></block></value><value name="B"><block
        type="variables_get" id="h/$-h0vX$l^n,3;sBSpw"><field name="VAR"
        id="q7mI9!s.5{Bt$7`Pi}n6">day</field></block></value></block></value><value
        name="B"><block type="logic_compare" id="K1brDcR$1d6=YG$c0ht6"><field
        name="OP">LT</field><value name="A"><block type="oh_zdt_now"
        id="F^cD^5Um8Lz!N4dI^yTB"></block></value><value name="B"><block
        type="variables_get" id="?EySoBNTuB5r:@xps6kl"><field name="VAR"
        id="ucR5#`a*$i3Kn`L+y~WJ">prenight</field></block></value></block></value></block></value><statement
        name="DO0"><block type="oh_event" id="QCmdh^F:7`iLe30RrI!#"><field
        name="eventType">sendCommand</field><value name="value"><shadow
        type="text" id="i?Dp$D`ZN73Q5}zH|T/,"><field
        name="TEXT">DAY</field></shadow></value><value name="itemName"><shadow
        type="oh_item" id="a{8Y..Eo1{,wVL@_6+E9"><mutation itemName="TimeOfDay"
        itemLabel="TimeOfDay"></mutation><field
        name="itemName">TimeOfDay</field></shadow></value></block></statement><next><block
        type="controls_if" id="peCpZD+xZ_K]Ni7m`!~5"><value name="IF0"><block
        type="logic_operation" id="@nEFuMF/tW@p]?=./GWS"><field
        name="OP">AND</field><value name="A"><block type="logic_compare"
        id="#o?2YY-#[WkH@fT8d(QK"><field name="OP">GT</field><value
        name="A"><block type="oh_zdt_now"
        id="v*9ILp#G$Lpgc;[Ssk[V"></block></value><value name="B"><block
        type="variables_get" id="ZvxL;8qABM~Kn/t1L3v9"><field name="VAR"
        id="ucR5#`a*$i3Kn`L+y~WJ">prenight</field></block></value></block></value><value
        name="B"><block type="logic_compare" id="jK{UkVO/H4C::s@]^(z6"><field
        name="OP">LT</field><value name="A"><block type="oh_zdt_now"
        id="zij^(jL+%%5bcGg@oU^U"></block></value><value name="B"><block
        type="variables_get" id="G|8zC9nb)L}A9[;(K.^^"><field name="VAR"
        id="6++x3!~GO6)sH)jhiX;_">night</field></block></value></block></value></block></value><statement
        name="DO0"><block type="oh_event" id="raECR0DLl2UI*^(E#f+#"><field
        name="eventType">sendCommand</field><value name="value"><shadow
        type="text" id="l@^jUIZ@MOVLJZe4,w0{"><field
        name="TEXT">PRENIGHT</field></shadow></value><value
        name="itemName"><shadow type="oh_item"
        id="(5OH[hsz}]_`E:byWO)t"><mutation itemName="TimeOfDay"
        itemLabel="TimeOfDay"></mutation><field
        name="itemName">TimeOfDay</field></shadow></value></block></statement><next><block
        type="controls_if" id="B)mSl#]R;(ORHbJbs|`9"><value name="IF0"><block
        type="logic_operation" id="rFA./:VTkq^3F3okoZhO"><field
        name="OP">OR</field><value name="A"><block type="logic_compare"
        id="EA,{H:wy5lN)_|ncE|0m"><field name="OP">GT</field><value
        name="A"><block type="oh_zdt_now"
        id="N,ExRy?K:e7Hzl)3vE1v"></block></value><value name="B"><block
        type="variables_get" id="t/qsFnq.l%HzjVU(MJgA"><field name="VAR"
        id="6++x3!~GO6)sH)jhiX;_">night</field></block></value></block></value><value
        name="B"><block type="logic_compare" id=",.M4rG?gX?_,FwV26I*y"><field
        name="OP">LT</field><value name="A"><block type="oh_zdt_now"
        id="t_e#`6R{Cg64N9xoK,y["></block></value><value name="B"><block
        type="variables_get" id="408fSxn?e+c!m%n)}L:F"><field name="VAR"
        id="LC5fL$)/7wd[)qTcC}!l">premorning</field></block></value></block></value></block></value><statement
        name="DO0"><block type="oh_event" id="P?ELH5k6E#y9q{p^0eyO"><field
        name="eventType">sendCommand</field><value name="value"><shadow
        type="text" id="}mmYPi_)Rs9n#;Arw#]@"><field
        name="TEXT">NIGHT</field></shadow></value><value name="itemName"><shadow
        type="oh_item" id="9*AW*WNo_Ruy6;2|8Y;="><mutation itemName="TimeOfDay"
        itemLabel="TimeOfDay"></mutation><field
        name="itemName">TimeOfDay</field></shadow></value></block></statement></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></xml>
      type: application/javascript
      script: >
        var weekend, dayAqua, nightAqua, premorning, morning, day, prenight,
        night;



        weekend = actions.Ephemeris.isWeekend(0);

        dayAqua = (time.ZonedDateTime.now()).withHour(9).withMinute(0).withSecond(0);

        nightAqua = (time.ZonedDateTime.now()).withHour(21).withMinute(0).withSecond(0);

        premorning = (time.ZonedDateTime.now()).withHour(5).withMinute(0).withSecond(0);

        morning = (time.ZonedDateTime.now()).withHour(6).withMinute(0).withSecond(0);

        day = (time.ZonedDateTime.now()).withHour(8).withMinute(0).withSecond(0);

        prenight = (time.ZonedDateTime.now()).withHour(20).withMinute(0).withSecond(0);

        night = (time.ZonedDateTime.now()).withHour(22).withMinute(0).withSecond(0);

        if (weekend == true) {
          items.getItem('WeekendTime').sendCommand('ON');
        } else {
          items.getItem('WeekendTime').sendCommand('OFF');
        }

        if ((time.ZonedDateTime.now()) > (time.toZDT(items.getItem('SonnenaufgangStart').state)) && (time.ZonedDateTime.now()) < (time.toZDT(items.getItem('SonnenuntergangStart').state))) {
          items.getItem('DayTime').sendCommand('ON');
        } else {
          items.getItem('DayTime').sendCommand('OFF');
        }

        if ((time.ZonedDateTime.now()) > dayAqua && (time.ZonedDateTime.now()) < nightAqua) {
          items.getItem('AquarienTime').sendCommand('DAY');
        } else {
          items.getItem('AquarienTime').sendCommand('NIGHT');
        }

        if ((time.ZonedDateTime.now()) > premorning && (time.ZonedDateTime.now()) < morning) {
          items.getItem('TimeOfDay').sendCommand('PREMORNING');
        }

        if ((time.ZonedDateTime.now()) > morning && (time.ZonedDateTime.now()) < day) {
          items.getItem('TimeOfDay').sendCommand('MORNING');
        }

        if ((time.ZonedDateTime.now()) > day && (time.ZonedDateTime.now()) < prenight) {
          items.getItem('TimeOfDay').sendCommand('DAY');
        }

        if ((time.ZonedDateTime.now()) > prenight && (time.ZonedDateTime.now()) < night) {
          items.getItem('TimeOfDay').sendCommand('PRENIGHT');
        }

        if ((time.ZonedDateTime.now()) > night || (time.ZonedDateTime.now()) < premorning) {
          items.getItem('TimeOfDay').sendCommand('NIGHT');
        }
    type: script.ScriptAction

Another fakt, if i change something in WHEN part, RAM increase also.

Thanks.

The way that any Java program works is as follows:

  1. when more RAM is needed it acquires more
  2. it never give RAM back to the system, once acquired the Java process keeps it
  3. when stuff in memory is no longer needed, it is merely marked as no longer being used
  4. garbage collection goes through memory and frees all the stuff it finds as no longer being used when
    • memory is requested and there isn’t any free space open
    • periodically
    • on command
  5. if the Java program grows to the point where it exceeds the maximum amount of memory it’s allowed to have (command line arguments), and not enough memory is freed through garbage collection, it will throw OutOfMemory exceptions and basically crash.

Given the above, your tests above have much less meaning than you might guess. All it shows is that Java needs some memory to parse and load a rule. It doesn’t show how much of that memory it needs to keep long term. It has no bearing on your actual problem here.

If you really want to run a test, crank down the maximum heap command line arguments until OH starts to crash with OOM exceptions. Then crank it back up a little until the OOM exceptions stop and the overall performance of OH is acceptable (garbage collection will slow things down a lot). If that doesn’t solve the problem, then my conclusion from almost two weeks ago is proven to be the case. You have too much running on this machine. You need to move something somewhere else.

It’s very clear that with a default configuration of OH you have too much running on this machine. You might be able to tweak OH to live in less RAM and make it work. I highly doubt it given all the evidence but you are more than welcome to try.

Also, this has nothing to do with Blockly. Blockly doesn’t actually run as it’s own thing. It gets converted to JS Scripting. And it’s converted to JS Scripting in the browser so any additional load caused by Blockly is going to be on another machine, not the OH server machine.