How to find the cause of a OutOfMemoryError in OH2?

I saw prometheus later after some research on snmp for my Q-nap, I’ll give it a try thanks.

Seems great but it doesn’t seems to work with openhab2.4

I got an error when openhab try to install one of the .jar file.

I’ve managed to make this one work but it only collect item states, which is not really helpfull.

I might try to built around that but i’m not sure how far i can go…

Be sure to leave a comment on the thread I linked to. The guys who put it together are pretty responsive but might not see this post.

true, will do.

As for my java memory problem, I’ve reinstalled all my stuff last saturday :

mqtt,astro,exec,network
mail
openhabcloud,market
  + spotify beta
With all the corresponding rules and items

I’ve never had a bug until today.

BUT i’m pretty sure the culprit is the prometheus setup i did, no mention of java there :

2019-10-29 21:00:37.334 [WARN ] [thome.io.rest.internal.DTOMapperImpl] - Field 'editable' could not be eliminated: Can not set boolean field org.eclipse.smarthome.io.rest.core.item.EnrichedItemDTO.editable to null value
2019-10-29 21:00:37.340 [WARN ] [thome.io.rest.internal.DTOMapperImpl] - Field 'editable' could not be eliminated: Can not set boolean field org.eclipse.smarthome.io.rest.core.item.EnrichedItemDTO.editable to null value
2019-10-29 21:00:37.350 [WARN ] [thome.io.rest.internal.DTOMapperImpl] - Field 'editable' could not be eliminated: Can not set boolean field org.eclipse.smarthome.io.rest.core.item.EnrichedItemDTO.editable to null value
2019-10-29 21:00:37.354 [WARN ] [thome.io.rest.internal.DTOMapperImpl] - Field 'editable' could not be eliminated: Can not set boolean field org.eclipse.smarthome.io.rest.core.item.EnrichedItemDTO.editable to null value
2019-10-29 21:00:37.360 [WARN ] [thome.io.rest.internal.DTOMapperImpl] - Field 'editable' could not be eliminated: Can not set boolean field org.eclipse.smarthome.io.rest.core.item.EnrichedItemDTO.editable to null value
2019-10-29 21:00:37.365 [WARN ] [thome.io.rest.internal.DTOMapperImpl] - Field 'editable' could not be eliminated: Can not set boolean field org.eclipse.smarthome.io.rest.core.item.EnrichedItemDTO.editable to null value
2019-10-29 21:00:37.370 [WARN ] [thome.io.rest.internal.DTOMapperImpl] - Field 'editable' could not be eliminated: Can not set boolean field org.eclipse.smarthome.io.rest.core.item.EnrichedItemDTO.editable to null value
2019-10-29 21:00:37.373 [WARN ] [thome.io.rest.internal.DTOMapperImpl] - Field 'editable' could not be eliminated: Can not set boolean field org.eclipse.smarthome.io.rest.core.item.EnrichedItemDTO.editable to null value
2019-10-29 21:00:41.517 [INFO ] [basic.internal.servlet.WebAppServlet] - Stopped Basic UI
2019-10-29 21:00:52.698 [INFO ] [ing.zwave.handler.ZWaveSerialHandler] - Stopped ZWave serial handler
2019-10-29 21:00:53.454 [INFO ] [io.openhabcloud.internal.CloudClient] - Shutting down openHAB Cloud service connection
2019-10-29 21:00:53.503 [INFO ] [io.openhabcloud.internal.CloudClient] - Disconnected from the openHAB Cloud service (UUID = uuid, base URL = http://localhost:8080)
2019-10-29 21:00:53.712 [INFO ] [assic.internal.servlet.WebAppServlet] - Stopped Classic UI
2019-10-29 21:00:53.769 [INFO ] [ui.habmin.internal.servlet.HABminApp] - Stopped HABmin servlet
2019-10-29 21:00:54.942 [INFO ] [arthome.ui.paper.internal.PaperUIApp] - Stopped Paper UI
2019-10-29 21:00:54.979 [WARN ] [e.jetty.util.thread.QueuedThreadPool] - QueuedThreadPool[ESH-httpClient-common]@e0d607{STOPPING,10<=10<=40,i=0,q=6}[org.eclipse.jetty.util.thread.TryExecutor$$Lambda$116/26664676@16b5006] Couldn't stop Thread[ESH-httpClient-common-111,5,main]
2019-10-29 21:00:54.983 [WARN ] [e.jetty.util.thread.QueuedThreadPool] - QueuedThreadPool[ESH-httpClient-common]@e0d607{STOPPING,10<=10<=40,i=0,q=6}[org.eclipse.jetty.util.thread.TryExecutor$$Lambda$116/26664676@16b5006] Couldn't stop Thread[ESH-httpClient-common-117,5,main]
2019-10-29 21:00:55.007 [INFO ] [panel.internal.HABPanelDashboardTile] - Stopped HABPanel
2019-10-29 21:00:55.038 [INFO ] [.dashboard.internal.DashboardService] - Stopped Dashboard

So i went from 8 hours before crash to a couple of days without any problem, I think we can conclude that the nest binding was the problem.

My binding was taking information of 2 smoke Detector with 3 String and 1 Switch item each. Couple of rule that were emailing in case of problem.

I hope this litlle experience will help some people!

Well, I suppose that’s a good news/bad news situation. The good news (if you can call it that) is that the Nest Binding is going to become dead at some point soon anyway as soon as Google decides to turn off the Works with Nest API. The bad news is this means any problems with the binding are unlikely to be looked at and fixed.

I can confirm the issue with nest binding. I did migrate the nest account with google. After that my OH2 started failing with OutOfMemory errors. It could stay running some hours after reboot and then randomly reporting out of heap or metaspace .

"Exception in thread "upnp-main-2" java.lang.OutOfMemoryError: unable to create new native thread"

I did install visualvm to my desktop and connected remotely to OH2 rpi. It showed increasing number of HttpClient threads, over 3700 active threads when stopped responding… Currently without Nest binding my OH2 runs around 150 threads.

Following startup parameters needed in “/etc/default/openhab2” to allow remote visualvm connection.

EXTRA_JAVA_OPTS="-Xms250m -Xmx512m -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9999 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -XX:+UnlockDiagnosticVMOptions -Dcom.sun.management.jmxremote.rmi.port=9999 -Dcom.sun.management.jmxremote.local.only=false -Djava.rmi.server.hostname=ADD_RPI_IP_HERE"