OH3 Crashes with OutOfMemoryError

Since I upgraded to OH3 I get crashes. After some time I have this error in console:

openhab_1  | Launching the openHAB runtime...
openhab_1  | Exception in thread "Timer-6" java.lang.OutOfMemoryError: Java heap space
openhab_1  |    at java.base/java.util.Arrays.copyOfRange(Arrays.java:4030)
openhab_1  |    at java.base/java.lang.StringLatin1.newString(StringLatin1.java:715)
openhab_1  |    at java.base/java.lang.StringBuffer.toString(StringBuffer.java:715)
openhab_1  |    at java.base/java.io.StringWriter.toString(StringWriter.java:218)
openhab_1  |    at com.google.gson.Gson.toJson(Gson.java:604)
openhab_1  |    at com.google.gson.Gson.toJson(Gson.java:583)
openhab_1  |    at org.openhab.core.storage.json.internal.JsonStorage.flush(JsonStorage.java:294)
openhab_1  |    at org.openhab.core.storage.json.internal.JsonStorage$CommitTimerTask.run(JsonStorage.java:328)
openhab_1  |    at java.base/java.util.TimerThread.mainLoop(Timer.java:556)
openhab_1  |    at java.base/java.util.TimerThread.run(Timer.java:506)
openhab_1  | Exception in thread "qtp9285450-81" java.lang.OutOfMemoryError: Java heap space
openhab_1  | Exception in thread "SocketListener(172-20-0-1.local.)" java.lang.OutOfMemoryError: Java heap space
openhab_1  | Exception in thread "SocketListener(172-24-0-1.local.)" java.lang.OutOfMemoryError: Java heap space
openhab_1  | Exception in thread "JmDNS(172-29-0-1.local.).Timer" java.lang.OutOfMemoryError: Java heap space
openhab_1  | Exception in thread "SocketListener(172-29-0-1.local.)" java.lang.IllegalStateException: Timer already cancelled.
openhab_1  | Exception in thread "SocketListener(172-27-0-1.local.)" Exception in thread "items-3"      at java.base/java.util.Timer.sched(Timer.java:398)
openhab_1  |    at java.base/java.util.Timer.schedule(Timer.java:194)
openhab_1  |    at javax.jmdns.impl.DNSTaskStarter$DNSTaskStarterImpl$StarterTimer.schedule(DNSTaskStarter.java:219)
openhab_1  | Exception in thread "qtp9285450-266" Exception in thread "OH-discovery-1460" Exception in thread "JmDNS(172-21-0-1.local.).State.Timer" Exception in thread "JmDNS(172
-29-0-1.local.).State.Timer" Exception in thread "JmDNS(172-20-0-1.local.).Timer"       at javax.jmdns.impl.tasks.Responder.start(Responder.java:98)
openhab_1  |    at javax.jmdns.impl.DNSTaskStarter$DNSTaskStarterImpl.startResponder(DNSTaskStarter.java:395)
openhab_1  |    at javax.jmdns.impl.JmDNSImpl.startResponder(JmDNSImpl.java:1770)
openhab_1  | Exception in thread "OH-modbusManagerPollerThreadPool-143" Exception in thread "SocketListener(192-168-178-33.local.)" Exception in thread "JmDNS(172-17-0-1.local.).S
tate.Timer" Exception in thread "JmDNS(172-24-0-1.local.).State.Timer" Exception in thread "JmDNS(172-20-0-1.local.).State.Timer" Exception in thread "SocketListener(172-17-0-1.lo
cal.)" Exception in thread "SocketListener(2a02-6d40-264d-5c01-90e8-4584-8f15-477b-eth0.local.)"        at javax.jmdns.impl.JmDNSImpl.handleQuery(JmDNSImpl.java:1560)
openhab_1  |    at javax.jmdns.impl.SocketListener.run(SocketListener.java:75)
openhab_1  | Exception in thread "JmDNS(172-27-0-1.local.).State.Timer" java.lang.OutOfMemoryError: Java heap space
openhab_1  | java.lang.OutOfMemoryError: Java heap space
openhab_1  | java.lang.OutOfMemoryError: Java heap space
openhab_1  | java.lang.OutOfMemoryError: Java heap space
openhab_1  | java.lang.OutOfMemoryError: Java heap space
openhab_1  | java.lang.OutOfMemoryError: Java heap space
openhab_1  | java.lang.OutOfMemoryError: Java heap space
openhab_1  | java.lang.OutOfMemoryError: Java heap space
openhab_1  | java.lang.OutOfMemoryError: Java heap space
openhab_1  | java.lang.OutOfMemoryError: Java heap space
openhab_1  | java.lang.OutOfMemoryError: Java heap space
openhab_1  | java.lang.OutOfMemoryError: Java heap space
openhab_1  | java.lang.OutOfMemoryError: Java heap space
openhab_1  | java.lang.OutOfMemoryError: Java heap space
openhab_1  | java.lang.OutOfMemoryError: Java heap space

I use docker-compose on a raspi 4 with 4GB RAM. It would not be that bad if it just exited, but it just becomes unresponsive and does not exit so docker can’t restart it.

I use Shelly, MQTT and Modbus binding. After a crash all history data is gone and the shellies are also deleted

Hi!
Could be the same problem stated here?

If it is, it seems it has been fixed here:

So should be fixed in the next release if you are on stable.

Otherwise…let’s wait someone more expert :wink:

1 Like

Hello,

I experienced something similar. I had a migrated OH3 running stable for a few weeks. Three days ago, I decided to integrate my Pluggit Ventilation System via Modbus. I set up about 10 Pollers and Data Things, and after a few hours my OH3 crashed with Java Heap Space Error. After that, I increased poll time to 300.000ms (which is 5 Minutes) but it still crashed after 12 hours.

To see if Modbus is really the blame, I disabled all Modbus Bridges and things. And since that point of time, system is running fine again.

So if you are not using DSL rules via UI, perhaps Modbus is the reason.

1 Like

DSL Rules were the problem. Is this fixed in 3.0.1 or 3.1.0

I am not sure. I use 3.1 M1 and today the system gets unresponsive and the log was full with java heap space errors. All DSL rules are in main ui and with the snapshots before the update to M1 there was no problem.

Raspbian GNU/Linux 10 (buster)
Linux 5.10.17-v7l+ x86
Raspberry Pi 4 Model B Rev 1.4 8GB
Openhab 3.1.0-2240

Since what felt like the last 30 snapshots, Openhab 3.1.x has become more and more sluggish after a running time of approx. 8 hours and then stops working completely.
Logging is still active.

That means the Habpanel, HappApp and also the DSL rules are no longer processed.

After a restart, OH runs perfectly again for about 8 hours.

The first warning messages in the logbook are:
2021-03-08 06: 52: 41.939 [WARN] [ab.core.internal.events.EventHandler] - Dispatching event to subscriber ‘org.openhab.core.internal.items.ItemUpdater@a0ac64’ takes more than 5000ms.
2021-03-08 06: 55: 39.494 [WARN] [ab.core.internal.events.EventHandler] - Dispatching event to subscriber ‘org.openhab.core.internal.items.ItemUpdater@a0ac64’ takes more than 5000ms.
2021-03-08 06: 58: 23.832 [WARN] [ab.core.internal.events.EventHandler] - Dispatching event to subscriber ‘org.openhab.core.internal.items.ItemUpdater@a0ac64’ takes more than 5000ms.
2021-03-08 06: 58: 46.834 [WARN] [ab.core.internal.events.EventHandler] - Dispatching event to subscriber ‘org.openhab.core.internal.items.ItemUpdater@a0ac64’ takes more than 5000ms.
2021-03-08 06: 59: 20.055 [WARN] [ab.core.internal.events.EventHandler] - Dispatching event to subscriber ‘org.openhab.core.internal.items.ItemUpdater@a0ac64’ takes more than 5000ms.

Then followed by timeouts of all bindings and rules failures, etc.
Then “OutOfMemoryError: Java heap space” can also be found in the log!

I haven’t made any major changes to the system in weeks.

I only switched to the 3.1 snapshots because of the “Java Heap Space” problem with DSL rules via MainUI in OH3.0, because unfortunately the problem was only fixed here.

I don’t find the problem, it must be due to a significant change in the OH3.1 snapshot.

I hope not that this stand will flow into the 3.1 final.

Unfortunately, I can no longer say exactly from which snapshot version this problem occurred.

Can someone help me or confirm a similar problem?

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.