Script/Rule to Reboot Pi - java.lang.OutOfMemoryError: unable to create native thread

Maybe once every other month I get this error below and it basically stops OH from working.

Does anybody have a rule/script that would catch this in the openhab.log and then reboot Pi?

2023-08-31 19:36:43.581 [WARN ] [org.apache.karaf.services.eventadmin              ] - EventAdmin: Exception: java.lang.OutOfMemoryError: unable to create native thread: possibly out of memory or process/resource limits reached
java.lang.OutOfMemoryError: unable to create native thread: possibly out of memory or process/resource limits reached

Best, Jay

Just run a cron job as root

grep 'java.lang.OutOfMemoryError' /openhab/userdata/logs/openhab.log && reboot

I think, once openhab reboots, it’ll start a new log file so this won’t get re-detected, but do verify this.

But of course you might want to figure out why this happened. Maybe buy a Pi with more RAM?

1 Like

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