Openhab running out of memory with V3.1.0 on RPI 3b

  • Platform information:
    *rpi 3b 1 Gb ram
    openhabian
    • openHAB version: 3.1.0
  • Issue of the topic: Run out of memory
    please be detailed explaining your issue
    I have 7 binding (Domintell & IpCamera installed by script) + ( Sonos, Shelly, Hue, Gardena; MQTT visible as add-ons from UI )
    52 things
    243 items (noy yet all things imported as equipement & Items in the Model)

No rules running (rules only via Nodered running on another RPi)

I am surprised to be limited by memory.

I begun to have some strange situation where things seems to exists but not connected to real life (one one Sonos player).

I tried to remove some unused things but could not succeed up to now.
Is it normal to reach this memory limit?

If I remove things configured by autodiscovery, can I later put them back one by one (only the ones i really need)
Advice to free RAM are welcome.
My RPI is running for 214 days, is RAM use increasing along time with the same configuration?

Thanks for any help

Logs? In particular are you seeing OutOfMemory errors in the logs? If so you are likely hitting a memory leak. There are some combinations of add-ons and configs and such that can uncover a memory leak. There were a number fixed before the release of 3.3 so, assuming the problem is that, all I can suggest is to upgrade to the latest release.

Are you asking if the RAM use should increase over time with no change to configuration? The answer to that question would be no. The system should not use continuously increasing more RAM over time.

Next question, what makes you think the system is running out of memory?
What else is running on the host system other then openHAB?

Edit: What is Domintell?

Hello,
The information about memory trouble came one time when having trouble refreshing the UI when I try to remove again a thing. ( I read somewhere in the forum that removing a thing can be forced if it is not effective at first time)
Then I just try to connect to my RPi using putty and then started the Openhab cli to watch the log.
I got trouble to open the Openhab cli and finally I received some out ou memory error messages so Cli is not working…
Then I checked the summary given at the openhabian connection and memory free is 0.02 Gb…

Thanks for your answer.
Domintell is a Belgian brand for domotic system I have at home.
I found previously some guy in this forum that developped a binding for this system, unfortunately he did not convert it to add-ons that can be used by UI. He just share the binding file that I installed on the RPi in the right add on directory and changed manually the config files.
I read many time that hybrid configuration is not a good thing but had no other choice ( and it was working very good up to now).
I am a beginner, I discovered Openhab before version 3 but did not really use it so I am not used to the file configuration.

All other configuration (Model, things, other binding) were done using only the UI .
To generate systematically the items for my domintell things, I used some tools developped by @ysc using yml and API interface.

I was working well for month.
Later I added some Shelly things to monitor energy.

I recently added the Gardena binding to manage my mower and irrigation stuff and then one more Sonos player in the model.
I probably reached the memory limit at that time.
There nothing else than Openhab running on this RPi ( except perhaps nodered but I am not using it, so I will try to stop it, then remove it from openhabian configuration )
I hope that this way I can at least give more memory space.
Then later I should update openhabian, upgrade Openhab

Please find some more trace of memory status and my progress up to now

###############################################################################
###############  openhabian  ##################################################
###############################################################################
##        Ip = 192.168.1.35
##   Release = Raspbian GNU/Linux 11 (bullseye)
##    Kernel = Linux 5.10.63-v7+
##  Platform = none
##    Uptime = 214 day(s). 13:10:16
## CPU Usage = 1.51% avg over 4 cpu(s) (4 core(s) x 1 socket(s))
##  CPU Load = 1m: 0.25, 5m: 0.11, 15m: 0.03
##    Memory = Free: 0.03GB (3%), Used: 0.91GB (97%), Total: 0.94GB
##      Swap = Free: 2.00GB (89%), Used: 0.24GB (11%), Total: 2.24GB
##      Root = Free: 22.00GB (79%), Used: 5.76GB (21%), Total: 28.99GB
##   Updates = 191 apt updates available.
##  Sessions = 1 session(s)
## Processes = 135 running processes of 32768 maximum processes
###############################################################################


                           _   _     _     ____
   ___   ___   ___   ___  | | | |   / \   | __ )
  / _ \ / _ \ / _ \ / _ \ | |_| |  / _ \  |  _ \
 | (_) | (_) |  __/| | | ||  _  | / ___ \ | |_) )
  \___/|  __/ \___/|_| |_||_| |_|/_/   \_\|____/
       |_|       3.1.0 - Release Build

Use '<tab>' for a list of available commands
and '[cmd] --help' for help on a specific command.
To exit, use '<ctrl-d>' or 'logout'.

Error in initialization script: /var/lib/openhab/etc/shell.init.script: java.lan                                    g.OutOfMemoryError: unable to create native thread: possibly out of memory or pr                                    ocess/resource limits reached
Error in initialization script: /var/lib/openhab/etc/scripts/shell.completion.sc                                    ript: java.lang.OutOfMemoryError: unable to create native thread: possibly out o                                    f memory or process/resource limits reached
Error in initialization script: /var/lib/openhab/etc/scripts/shell.colors.script                                    : java.lang.OutOfMemoryError: unable to create native thread: possibly out of me                                    mory or process/resource limits reached

Desactivating framebuffer inside Openhabian config menu

+ echo -n '2022-11-01_09:04:06_CET [openHABian] Turning the framebuffer off... '
2022-11-01_09:04:06_CET [openHABian] Turning the framebuffer off... + cond_redirect /usr/bin/tvservice -o
+ [[ -n '' ]]
+ echo -e '\n\033[90;01m$ /usr/bin/tvservice -o \033[39;49;00m'

$ /usr/bin/tvservice -o
+ /usr/bin/tvservice -o
Powering off HDMI
+ return 0
+ echo OK
OK
+ echo max_framebuffers=0
+ '[' 0 -ne 0 ']'

Checking memory after this

openhabian@openhabian:~ $ grep MemTotal /proc/meminfo
MemTotal:         996096 kB
openhabian@openhabian:~ $ grep MemFree /proc/meminfo
MemFree:          118060 kB

Stopping nodered and check how much saved memory

openhabian@openhabian:~ $ node-red-stop
Stop Node-RED

Use   node-red-start   to start Node-RED again

openhabian@openhabian:~ $ grep MemFree /proc/meminfo
MemFree:          144300 kB
openhabian@openhabian:~ $ free
               total        used        free      shared  buff/cache   available
Mem:          996096      590896      138840         472      266360      351612
Swap:        2350072      316248     2033824

So now it seems more confortable .

I could remove things properly from the UI
Next step will be the upgrade

Hello,

I thought my memory trouble were solved but it is not the case at all.
Yesterday status when connecting with putty

##    Uptime = 227 day(s). 3:22:53
## CPU Usage = 1.25% avg over 4 cpu(s) (4 core(s) x 1 socket(s))
##  CPU Load = 1m: 0.31, 5m: 0.11, 15m: 0.08
##    Memory = Free: 0.02GB (3%), Used: 0.92GB (97%), Total: 0.94GB
##      Swap = Free: 1.99GB (89%), Used: 0.24GB (11%), Total: 2.24GB
##      Root = Free: 22.00GB (79%), Used: 5.77GB (21%), Total: 28.99GB

Openhab frontail keep ginving error message linked to possible memory troubles
/var/log/openhab/openhab.log

-11-04 00:11:23.364 [WARN ] [ache.cxf.phase.PhaseInterceptorChain] - Exception in handleFault on interceptor org.apache.cxf.jaxrs.interceptor.JAXRSDefaultFaultOutInterceptor@1167e86
org.apache.cxf.interceptor.Fault: unable to create native thread: possibly out of memory or process/resource limits reached
at org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:162) ~[bundleFile:3.4.3]
...
022-11-04 00:11:23.379 [ERROR] [.AbstractFaultChainInitiatorObserver] - An unexpected error occurred during error handling. No further error processing will occur.
org.apache.cxf.interceptor.Fault: unable to create native thread: possibly out of memory or process/resource limits reached
...
2022-11-04 00:11:23.393 [WARN ] [org.eclipse.jetty.server.HttpChannel] - /rest/items/Consommation_electrique_globale_TotalReturnedEnergy
org.apache.cxf.interceptor.Fault: unable to create native thread: possibly out of memory or process/resource limits reached
...
Caused by: java.lang.OutOfMemoryError: unable to create native thread: possibly out of memory or process/resource limits reached
	at java.lang.Thread.start0(Native Method) ~[?:?]
...

06 [WARN ] [e.internal.SseItemStatesEventBuilder] - Attempting to send a state update of an item which doesn't exist: Storebureau_shellyswitch25_RollerControl0open100closed

today status when connecting with Putty

   Uptime = 228 day(s). 1:49:23
## CPU Usage = 1% avg over 4 cpu(s) (4 core(s) x 1 socket(s))
##  CPU Load = 1m: 0.10, 5m: 0.07, 15m: 0.07
##    Memory = Free: 0.02GB (3%), Used: 0.92GB (97%), Total: 0.94GB
##      Swap = Free: 1.99GB (89%), Used: 0.24GB (11%), Total: 2.24GB
##      Root = Free: 22.00GB (79%), Used: 5.77GB (21%), Total: 28.99GB
...
openhabian@openhabian:~ $ free
               total        used        free      shared  buff/cache   available
Mem:          996096      615968       38248         540      341880      328120
Swap:        2350072      282872     2067200
...
top - 08:30:40 up 228 days, 13:37,  1 user,  load average: 0.11, 0.11, 0.04
Tasks: 130 total,   1 running, 129 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.9 us,  0.2 sy,  0.0 ni, 98.8 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
MiB Mem :    972.8 total,     37.4 free,    601.3 used,    334.1 buff/cache
MiB Swap:   2295.0 total,   2018.8 free,    276.2 used.    320.7 avail Mem

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
  753 openhab   20   0 1289936 263716   5844 S   5.3  26.5   9194:58 java
29005 openhab+  20   0   11568   3124   2580 R   1.0   0.3   0:00.22 top
28524 openhab+  20   0   14476   4420   3512 S   0.3   0.4   0:00.03 sshd
    1 root      20   0   34972   6168   4420 S   0.0   0.6   7:41.97 systemd
    2 root      20   0       0      0      0 S   0.0   0.0   0:45.09 kthreadd
    3 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 rcu_gp
    4 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 rcu_par_gp
    8 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 mm_percpu_wq

I also checked the list of warning from openhab log
openhab log warn.log.txt (56.2 KB)
and same for errors
Openhab log error.log.txt (45.1 KB)

Any help in analysing this information are welcome.
I did not change anything in the openhab config since the my last message in this thread.