java.lang.OutOfMemoryError caused by the Amazon Echo Control Binding

Hi I got the java.lang.OutOfMemoryError. I think it`s caused by the Amazon Echo Control Binding or maybe the openHAB Cloud Connector Binding because before I had it in use, I did not have this error yet. And it could be a configuration error if I am not wrong.

Platform Information

Hardware (virtual Machine) / VBoxManage showvminfo OpenHABVM:

Name:                        OpenHABVM
Groups:                      /
Guest OS:                    Ubuntu (64-bit)
UUID:                        8ff46c77-7e00-478a-8bde-6827d44bf788
Config file:                 /home/smarthome/VirtualBox VMs/OpenHABVM/OpenHABVM.vbox
Snapshot folder:             /home/smarthome/VirtualBox VMs/OpenHABVM/Snapshots
Log folder:                  /home/smarthome/VirtualBox VMs/OpenHABVM/Logs
Hardware UUID:               8ff46c77-7e00-478a-8bde-6827d44bf788
Memory size                  4096MB
Page Fusion:                 disabled
VRAM size:                   16MB
CPU exec cap:                100%
HPET:                        disabled
CPUProfile:                  host
Chipset:                     piix3
Firmware:                    BIOS
Number of CPUs:              2
PAE:                         disabled
Long Mode:                   enabled
Triple Fault Reset:          disabled
APIC:                        enabled
X2APIC:                      enabled
Nested VT-x/AMD-V:           disabled
CPUID Portability Level:     0
CPUID overrides:             None
Boot menu mode:              message and menu
Boot Device 1:               Floppy
Boot Device 2:               DVD
Boot Device 3:               HardDisk
Boot Device 4:               Not Assigned
ACPI:                        enabled
IOAPIC:                      enabled
BIOS APIC mode:              APIC
Time offset:                 0ms
RTC:                         UTC
Hardware Virtualization:     enabled
Nested Paging:               enabled
Large Pages:                 disabled
VT-x VPID:                   enabled
VT-x Unrestricted Exec.:     enabled
Paravirt. Provider:          Default
Effective Paravirt. Prov.:   KVM
State:                       running (since 2021-04-06T09:05:12.082000000)
Graphics Controller:         VMSVGA
Monitor count:               1
3D Acceleration:             disabled
2D Video Acceleration:       disabled
Teleporter Enabled:          disabled
Teleporter Port:             0
Teleporter Address:
Teleporter Password:
Tracing Enabled:             disabled
Allow Tracing to Access VM:  disabled
Tracing Configuration:
Autostart Enabled:           disabled
Autostart Delay:             0
Default Frontend:
VM process priority:         default
Storage Controller Name (0):            IDE
Storage Controller Type (0):            PIIX4
Storage Controller Instance Number (0): 0
Storage Controller Max Port Count (0):  2
Storage Controller Port Count (0):      2
Storage Controller Bootable (0):        on
Storage Controller Name (1):            SATA
Storage Controller Type (1):            IntelAhci
Storage Controller Instance Number (1): 0
Storage Controller Max Port Count (1):  30
Storage Controller Port Count (1):      1
Storage Controller Bootable (1):        on

...

OS / lsb_release -a:

Distributor ID: Ubuntu
Description:    Ubuntu 18.04.4 LTS
Release:        18.04
Codename:       bionic

Java Runtime Environment (JRE) / java -version:

openjdk version "1.8.0_252"
OpenJDK Runtime Environment (Zulu 8.46.0.19-CA-linux64) (build 1.8.0_252-b14)
OpenJDK 64-Bit Server VM (Zulu 8.46.0.19-CA-linux64) (build 25.252-b14, mixed mode)

openHAB version / dpkg --list | grep openhab:

ii  openhab2                                   2.5.5-1                                          all          openhab2
ii  openhab2-addons                            2.5.5-1                                          all          openhab2-addons

EXTRA_JAVA_OPTS / sudo cat /etc/default/openhab2:

...
EXTRA_JAVA_OPTS="-Xms1024m -Xmx1536m -XX:+HeapDumpOnOutOfMemoryError"
...

Error Message

And I get following message after “speaking to Alexa” inside the karaf console:

Error in initialization script: /var/lib/openhab2/etc/shell.init.script: java.lang.OutOfMemoryError: unable to create new native thread
Error in initialization script: /var/lib/openhab2/etc/scripts/shell.colors.script: java.lang.OutOfMemoryError: unable to create new native thread
Error in initialization script: /var/lib/openhab2/etc/scripts/shell.completion.script: java.lang.OutOfMemoryError: unable to create new native thread
openhab> log:tail
Error executing command: java.lang.OutOfMemoryError: unable to create new native thread

Although the error is there, openHAB can still continue to run to some extent. Only after multiple “errors” the system hangs. Individual commands, even via Alexa, can be executed until at some point nothing works anymore.

I know that -XX:+HeapDumpOnOutOfMemoryError will not avoid memory leaks but what else can I do?

Thanks in advance and best regards

I would suggest upgrading to latest 2.5 first.

That’s really quite elderly.
While not changing what is working is a good base plan, the rest of the world is beyond your control. Amazon has changed in the meantime, for example.
Now you’re in a not-working place, it’s probably time to move to 2.5.12

There was an OOM fix for Amazon in 2.5.6 I believe.

1 Like

Okay, I have updated it to 2.5.12-1. So far I have not been able to detect any errors, but openHAB is not active for several hours at a time. The heap could also be otherwise still busy. I can now observe this for a few days. Thanks again for your help.