openhab-addons: [boschshc] Long Polling crashes regularly every one or two days
Expected Behavior
Items reflecting Bosch Smart Home Things’ read channels shall be updated after every change.
Current Behavior
After one or two days the items (e.g. temperature, humidity, open/close states) are not updated anymore (values are frozen to the last updated value). A view in the openhab.log reveals this exception:
2023-11-17 05:58:17.372 [WARN ] [mmon.WrappedScheduledExecutorService] - Scheduled runnable ended with an exception:
com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:270) ~[?:?]
at com.google.gson.Gson.fromJson(Gson.java:1058) ~[?:?]
at com.google.gson.Gson.fromJson(Gson.java:1016) ~[?:?]
at com.google.gson.Gson.fromJson(Gson.java:959) ~[?:?]
at com.google.gson.Gson.fromJson(Gson.java:927) ~[?:?]
at org.openhab.binding.boschshc.internal.devices.bridge.LongPolling.onLongPollComplete(LongPolling.java:195) ~[?:?]
at org.openhab.binding.boschshc.internal.devices.bridge.LongPolling$1.lambda$0(LongPolling.java:164) ~[?:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) ~[?:?]
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:1136) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $
at com.google.gson.stream.JsonReader.beginObject(JsonReader.java:395) ~[?:?]
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:259) ~[?:?]
... 12 more
Possible Solution
No idea. I could dig deeper into this problem but I don’t know where to begin. Any advice is welcome.
Steps to Reproduce (for Bugs)
Let it go, let it fail. I just restart the binding or openhab itself. It happens regularly after one or two days.
Your Environment
- Version used: openHAB 4.0.4
- OS: Raspberry OS Lite, openHAB running in a docker container
About this issue
- Original URL
- State: open
- Created 7 months ago
- Comments: 25 (12 by maintainers)
Commits related to this issue
- [boschshc] Handle invalid long poll responses gracefully (#15912) If the long poll response from the Smart Home Controller does not contain valid JSON, the subscription is gracefully terminated a new... — committed to david-pace/openhab-addons by david-pace 7 months ago
- [boschshc] Handle invalid long poll responses gracefully (#15912) If the long poll response from the Smart Home Controller does not contain valid JSON, the subscription is gracefully terminated a new... — committed to david-pace/openhab-addons by david-pace 7 months ago
- [boschshc] Handle invalid long poll responses gracefully (#15912) If the long poll response from the Smart Home Controller does not contain valid JSON, the subscription is gracefully terminated a new... — committed to david-pace/openhab-addons by david-pace 7 months ago
- [boschshc] Handle invalid long poll responses gracefully (#15912) If the long poll response from the Smart Home Controller does not contain valid JSON, the subscription is gracefully terminated a new... — committed to david-pace/openhab-addons by david-pace 7 months ago
- [boschshc] Handle invalid long poll responses gracefully (#15912) If the long poll response from the Smart Home Controller does not contain valid JSON, the subscription is gracefully terminated a new... — committed to david-pace/openhab-addons by david-pace 7 months ago
Hi @xxthunder, thanks for the report. Let’s handle the
ConnectExceptionin a separate issue / pull request.However, I noticed that you got the wrong version of the JAR. Please refer to my last post in https://github.com/openhab/openhab-addons/pull/16002 to get the correct version of the JAR. Let’s continue our discussion in the pull request so that all testers can follow the same thread and that I don’t have to write instructions multiple times.
Thank you for your patience and your help 👍
Unfortunately I don’t know a solution to the feature resolution error.
But please keep the log file from yesterday with the
JsonSyntaxException. Did you set theDEBUGlog level for theboschshcbinding? If so, please look in for the following log entries directly before and after theJsonSyntaxExceptionand post them here:Could not deserialize long poll responseLong polling failed, will try to reconnectHi,
tried again today. I had to do search and replace in several MF files for gson deps. After that, the next dependency is not correct:
Is it not possible to build your fixes against the current stable release? This is a general pity somehow, as if users are willing to test fixes on their systems it should be as easy as possible for them to install the updated jars.
But anyway. I have no problem updating to 4.1.0. It will be the next stable anyway. Will your jar work with M5?
Regards, Karsten
Hi David, sorry for ignoring you but I was sick and now on a business trip.
I tried putting it into the add-ons folder, but of course the bundle:update is the way.
I will try tomorrow.
Regards, Karsten
I created a work in progress pull request. I use the existing mechanism to recover from long polling errors, which means that a new long polling subscription attempt is made 15 seconds after the faulty response.
It would be great if you could download the JAR and replace the JAR on your system, and then report what happens if the bridge responds with invalid content again. The best would be if you could share the relevant portion of the log file when it happens.
Hi, I am using the same version. And it happened again today and according to my logs before and after the 20th of November.
Thanks for the detailed bug report. I can confirm that I found the same exception in my logs, approximately 14 hours after openHAB was started, on November 13th.
When this happens the Bosch Smart Home Controller seems to send a response that does not contain valid JSON, at least not a syntactically correct JSON object.
I will try to enhance the logging on my system for this specific case in order to find out what the actual response from the controller looks like when this happens.