OutOfMemoryError after OH2.2 Update - OpenHabCloud and HTTP-Action are affected

Since I upgraded to openHAB 2.2.0-1 (Release Build), I have problems with myopenHAB Cloud Service and HTTP-Actions. My openHAB runs on a Raspberry Pi 3 Model B.

When I access the server with the Android app via remote URL, I suddenly have no connection to openHab. The log file contains the following message at this time:

2017-12-26 14:30:06.445 [WARN ] [io.openhabcloud.internal.CloudClient] - Jetty request 4729400 failed: null
2017-12-26 14:30:18.721 [WARN ] [io.openhabcloud.internal.CloudClient] - Jetty request 4729442 failed: null
2017-12-26 14:30:18.763 [WARN ] [io.openhabcloud.internal.CloudClient] - Jetty request 4729418 failed: null

After these error messages, the HTTP-Actions also no longer works. A rule that uses sendHttpGetRequest with the JSON transformation cyclically every 3 seconds produces the following message:

2017-12-26 14:30:21.491 [ERROR] [.smarthome.model.script.actions.HTTP] - Fatal transport error: java.util.concurrent.TimeoutException
2017-12-26 14:30:21.506 [ERROR] [ore.transform.actions.Transformation] - Error executing the transformation 'JSONPATH': the given parameters 'JSonPath' and 'source' must not be null
2017-12-26 14:30:21.519 [ERROR] [ore.transform.actions.Transformation] - Error executing the transformation 'JSONPATH': the given parameters 'JSonPath' and 'source' must not be null
2017-12-26 14:30:24.456 [ERROR] [.smarthome.model.script.actions.HTTP] - Fatal transport error: java.util.concurrent.TimeoutException
2017-12-26 14:30:24.471 [ERROR] [ore.transform.actions.Transformation] - Error executing the transformation 'JSONPATH': the given parameters 'JSonPath' and 'source' must not be null
2017-12-26 14:30:24.482 [ERROR] [ore.transform.actions.Transformation] - Error executing the transformation 'JSONPATH': the given parameters 'JSonPath' and 'source' must not be null
2017-12-26 14:30:27.491 [ERROR] [.smarthome.model.script.actions.HTTP] - Fatal transport error: java.util.concurrent.TimeoutException
2017-12-26 14:30:27.508 [ERROR] [ore.transform.actions.Transformation] - Error executing the transformation 'JSONPATH': the given parameters 'JSonPath' and 'source' must not be null
2017-12-26 14:30:27.516 [ERROR] [ore.transform.actions.Transformation] - Error executing the transformation 'JSONPATH': the given parameters 'JSonPath' and 'source' must not be null

After a certain amount of time this leads to this:

2017-12-26 14:32:41.180 [ERROR] [io.socket.thread.EventThread        ] - Task threw exception
java.lang.OutOfMemoryError: Java heap space
	at io.socket.engineio.parser.Parser.encodeByteArray(Parser.java:68) ~[219:org.openhab.io.openhabcloud:2.2.0]
	at io.socket.engineio.parser.Parser.encodePacket(Parser.java:51) ~[219:org.openhab.io.openhabcloud:2.2.0]
	at io.socket.engineio.parser.Parser.encodePacket(Parser.java:42) ~[219:org.openhab.io.openhabcloud:2.2.0]
	at io.socket.engineio.client.transports.WebSocket.write(WebSocket.java:184) ~[219:org.openhab.io.openhabcloud:2.2.0]
	at io.socket.engineio.client.Transport$3.run(Transport.java:108) ~[219:org.openhab.io.openhabcloud:2.2.0]
	at io.socket.thread.EventThread.exec(EventThread.java:55) ~[219:org.openhab.io.openhabcloud:2.2.0]
	at io.socket.engineio.client.Transport.send(Transport.java:103) ~[219:org.openhab.io.openhabcloud:2.2.0]
	at io.socket.engineio.client.Socket.flush(Socket.java:615) ~[219:org.openhab.io.openhabcloud:2.2.0]
	at io.socket.engineio.client.Socket.onDrain(Socket.java:606) ~[219:org.openhab.io.openhabcloud:2.2.0]
	at io.socket.engineio.client.Socket.access$1100(Socket.java:31) ~[219:org.openhab.io.openhabcloud:2.2.0]
	at io.socket.engineio.client.Socket$6.call(Socket.java:308) ~[219:org.openhab.io.openhabcloud:2.2.0]
	at io.socket.emitter.Emitter.emit(Emitter.java:117) ~[219:org.openhab.io.openhabcloud:2.2.0]
	at io.socket.engineio.client.transports.WebSocket$3$1.run(WebSocket.java:171) ~[219:org.openhab.io.openhabcloud:2.2.0]
	at io.socket.thread.EventThread$2.run(EventThread.java:80) [219:org.openhab.io.openhabcloud:2.2.0]
	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) [?:?]
2017-12-26 14:42:28.753 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber 'org.eclipse.smarthome.core.internal.items.ItemUpdater@23492a' takes more than 5000ms.

And a lot of these logs come after that:

2017-12-26 17:01:40.370 [WARN ] [eclipse.jetty.servlet.ServletHandler] - Error for /api/02a5f5ac-9760-4e5b-a2a5-411e9ae67d1d/lights
java.lang.OutOfMemoryError: Java heap space
2017-12-26 17:01:58.334 [WARN ] [eclipse.jetty.servlet.ServletHandler] - Error for /api/02a5f5ac-9760-4e5b-a2a5-411e9ae67d1d/lights
java.lang.OutOfMemoryError: Java heap space
2017-12-26 17:02:20.053 [WARN ] [eclipse.jetty.servlet.ServletHandler] - Error for /api/02a5f5ac-9760-4e5b-a2a5-411e9ae67d1d/lights
java.lang.OutOfMemoryError: Java heap space
2017-12-26 17:07:58.884 [ERROR] [io.socket.thread.EventThread        ] - Task threw exception
java.lang.OutOfMemoryError: Java heap space
2017-12-26 17:08:15.274 [ERROR] [io.socket.thread.EventThread        ] - Task threw exception
java.lang.OutOfMemoryError: Java heap space

The myopenHAB Cloud Service will restart at some point, but the rule including ‘sendHttpGetRequest’ was stopped.

2017-12-26 17:33:59.407 [INFO ] [io.openhabcloud.internal.CloudClient] - Disconnected from the openHAB Cloud service (UUID = 1cadcc4d-5682-4160-a09f-fc71caf0d5ef, base URL = http://localhost:80)
2017-12-26 17:34:00.391 [WARN ] [e.jetty.util.thread.QueuedThreadPool] - HttpClient@2091292{STOPPING,8<=8<=200,i=0,q=1} Couldn't stop Thread[HttpClient@2091292-67908,5,]
2017-12-26 17:34:02.173 [INFO ] [io.openhabcloud.internal.CloudClient] - Connected to the openHAB Cloud service (UUID = 1cadcc4d-5682-4160-a09f-fc71caf0d5ef, base URL = http://localhost:80)

Does anyone have any idea what this might be? Under openHab 2.1 this worked fine. No changes have been made to the rules or settings since then.

@mstormi, you were asking about out of memory issues on another thread.

@mas, this definitely looks suspicious. It is hard to say though without looking at the code.

It looks like you are passing the results from your httpGetRequest to the JSONPATH transform without first checking to see if you got anything back. That would explain the "JSonPath" and "source" must not be null errors.

Beyond that I can’t guess.