I’ve been having issues with OutOfMemoryError coming up a couple of times a day on my openHAB server and I’m hoping someone can give me some idea where/how to look for what the root cause of this is.
Here is what I know and what I’ve tried so far:
- The error is always the same (see below), its failing to spawn a new thread for the Network binding Presence Detection
- Almost every time it happens, but not always, openHAB crashes and restarts automatically
- I have tried turning on DEBUG level logging for the Network binding with
log:set DEBUG org.openhab.binding.network
but no entries appear in the log from the Network binding - I have tried doing a manual Heap Dump from the console, but the output does not include a
.hprof
file that I can open in the Eclipse MAT - I have also looked through the output of the manual dump and found nothing out of ordinary, although I was only able to generate the dump after openHAB had restarted because there is no warning when the error is about to happen
- I have tried adding
EXTRA_JAVA_OPTS="-XX:+HeapDumpOnOutOfMemoryError"
to my/etc/default/openhab2
file to get automatic dumps when the error happens, but I have seen no output in/var/lib/openhab2
which, as far as I can tell, is where I should see it
I realize this is a complex issue to resolve, and I am not looking for someone to do it for me, just looking for ideas from people with more experience with Java or just a fresh perspective that might see something I’ve missed.
Thanks
Mike
system info:
openHAB 2.3.0-1
debian linux 4.9.0-4-amd64
quad core intel 3gb ram
Java VM: Java HotSpot(TM) 64-Bit Server VM 25.191-b12
vendor: Oracle Corporation
version: 1.8.0_191
2019-01-03 08:07:29.110 [WARN ] [mmon.WrappedScheduledExecutorService] - Scheduled runnable ended with an exception
java.lang.OutOfMemoryError: unable to create new native thread
at java.lang.Thread.start0(Native Method) ~[?:?]
at java.lang.Thread.start(Thread.java:717) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:957) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1367) ~[?:?]
at org.openhab.binding.network.internal.PresenceDetection.performPresenceDetection(PresenceDetection.java:266) ~[?:?]
at org.openhab.binding.network.internal.PresenceDetection.lambda$4(PresenceDetection.java:479) ~[?:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:?]
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) ~[?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) ~[?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
at java.lang.Thread.run(Thread.java:748) [?:?]