stefan-kaestle / openhab2-addons

Add-ons for openHAB 2.x
Eclipse Public License 2.0
16 stars 1 forks source link

Null Pointer Exception during long polling #113

Closed coeing closed 1 year ago

coeing commented 2 years ago

Hey there - im not sure if that issue is identical with this resolved one - so please let me know if i should open a new one.. I also got the issue that "over night" anything happends so every bosch item stops reporting their values.. my grafana show that mostly during the night at 00:30 bosh just stops working (but only inside of OH - in the app everything works as it should..)

Afterwards you'll see the logs: ` 2021-11-05 00:29:01.745 [TRACE] [ernal.devices.bridge.BoschHttpClient] - Create request for http client BoschHttpClient@1c91c75{STARTED} 2021-11-05 00:29:01.747 [TRACE] [ernal.devices.bridge.BoschHttpClient] - create request for https://192.168.178.34:8444/remote/json-rpc and content {"jsonrpc":"2.0","method":"RE/longPoll","params":["ekfmeiced-7","20"]} 2021-11-05 00:29:01.771 [DEBUG] [.internal.devices.bridge.LongPolling] - Long poll response: {"result":[{"iconId":"icon_room_living_room","extProperties":{"humidity":"58.9"},"@type":"room","name":"Wohnzimmer","id":"hz_5"}],"jsonrpc":"2.0"}

2021-11-05 00:29:01.772 [DEBUG] [.internal.devices.bridge.LongPolling] - Sending long poll request 2021-11-05 00:29:01.774 [TRACE] [ernal.devices.bridge.BoschHttpClient] - Create request for http client BoschHttpClient@1c91c75{STARTED} 2021-11-05 00:29:01.775 [TRACE] [ernal.devices.bridge.BoschHttpClient] - create request for https://192.168.178.34:8444/remote/json-rpc and content {"jsonrpc":"2.0","method":"RE/longPoll","params":["ekfmeiced-7","20"]} 2021-11-05 00:29:21.791 [DEBUG] [.internal.devices.bridge.LongPolling] - Long poll response: {"result":[],"jsonrpc":"2.0"}

2021-11-05 00:29:21.805 [DEBUG] [.internal.devices.bridge.LongPolling] - Sending long poll request 2021-11-05 00:29:21.808 [TRACE] [ernal.devices.bridge.BoschHttpClient] - Create request for http client BoschHttpClient@1c91c75{STARTED} 2021-11-05 00:29:21.812 [TRACE] [ernal.devices.bridge.BoschHttpClient] - create request for https://192.168.178.34:8444/remote/json-rpc and content {"jsonrpc":"2.0","method":"RE/longPoll","params":["ekfmeiced-7","20"]} 2021-11-05 00:29:41.837 [DEBUG] [.internal.devices.bridge.LongPolling] - Long poll response: {"result":[],"jsonrpc":"2.0"}

2021-11-05 00:29:41.843 [DEBUG] [.internal.devices.bridge.LongPolling] - Sending long poll request 2021-11-05 00:29:41.845 [TRACE] [ernal.devices.bridge.BoschHttpClient] - Create request for http client BoschHttpClient@1c91c75{STARTED} 2021-11-05 00:29:41.847 [TRACE] [ernal.devices.bridge.BoschHttpClient] - create request for https://192.168.178.34:8444/remote/json-rpc and content {"jsonrpc":"2.0","method":"RE/longPoll","params":["ekfmeiced-7","20"]} 2021-11-05 00:29:46.900 [WARN ] [ng.tr064.internal.soap.SOAPConnector] - Failed to get Tr064ChannelConfig{channelType=wanIpAddress, getAction=GetInfo, dataType='string, parameter='null'}: HTTP-Response-Code 500 (Internal Server Error), SOAP-Fault: 401 (Invalid Action) 2021-11-05 00:30:00.603 [DEBUG] [.internal.devices.bridge.LongPolling] - Long poll response: {"result":[{"@type":"scenarioTriggered","name":"Gute Nacht","id":"681961da-788e-4e60-9555-3c0709684cc3","lastTimeTriggered":"1636068600374"}],"jsonrpc":"2.0"}

2021-11-05 00:30:00.617 [DEBUG] [.internal.devices.bridge.LongPolling] - Sending long poll request 2021-11-05 00:30:00.619 [TRACE] [ernal.devices.bridge.BoschHttpClient] - Create request for http client BoschHttpClient@1c91c75{STARTED} 2021-11-05 00:30:00.621 [TRACE] [ernal.devices.bridge.BoschHttpClient] - create request for https://192.168.178.34:8444/remote/json-rpc and content {"jsonrpc":"2.0","method":"RE/longPoll","params":["ekfmeiced-7","20"]} 2021-11-05 00:30:00.689 [DEBUG] [.internal.devices.bridge.LongPolling] - Long poll response: {"result":[{"deleted":false,"remainingTimeUntilArmed":963,"@type":"armingState","state":"SYSTEM_ARMING"}],"jsonrpc":"2.0"}

2021-11-05 00:30:00.691 [DEBUG] [devices.bridge.BoschSHCBridgeHandler] - Got update for null 2021-11-05 00:30:00.692 [DEBUG] [devices.bridge.BoschSHCBridgeHandler] - Registered device: hdm:HomeMaticIP:3014F711A000005BB85A7C8D - looking for null 2021-11-05 00:30:00.694 [WARN ] [mmon.WrappedScheduledExecutorService] - Scheduled runnable ended with an exception: java.lang.NullPointerException: null at org.openhab.binding.boschshc.internal.devices.bridge.BoschSHCBridgeHandler.handleLongPollResult(BoschSHCBridgeHandler.java:320) ~[?:?] at org.openhab.binding.boschshc.internal.devices.bridge.LongPolling.onLongPollComplete(LongPolling.java:215) ~[?:?] at org.openhab.binding.boschshc.internal.devices.bridge.LongPolling$1.lambda$0(LongPolling.java:171) ~[?:?] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) ~[?:?] at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) ~[?:?] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?] at java.lang.Thread.run(Thread.java:829) [?:?] `

So after this null-pointer bosch does not update any item within the OH-System, until i restart the binding.. Fun fact: The rule generating the issue is a Bosch-Rule that triggers itself at 00:30 to start a scenario

Originally posted by @limebond in https://github.com/stefan-kaestle/openhab2-addons/issues/109#issuecomment-961790997

coeing commented 2 years ago

@limebond Thanks for the report! :)

Looks like your alarm system is armed at 00:30 and sends an update to openHAB. But the alarm system is not bound to a specific device, so it has no device id and sends a null pointer. This special case is not handled yet in our plugin but should be easy to fix.

david-pace commented 1 year ago

This should be fixed meanwhile - the relevant code section in the stack trace (which can be traced back in the new code due to the log entries) is not called anymore if the device ID is null - this is ensured by an early return.

Please report any further issues in the official openhab-addons repository.