openhab / openhab1-addons

Add-ons for openHAB 1.x
Eclipse Public License 2.0
3.43k stars 1.71k forks source link

[FritzboxTr064]: Error while executing background thread FritzboxTr064 Refresh Service #5331

Open staehler opened 6 years ago

staehler commented 6 years ago

After some time running openhab this error appears:

2017-10-16 11:21:12.694 [ERROR] [b.core.service.AbstractActiveService] - Error while executing background thread FritzboxTr064 Refresh Service
java.lang.IllegalStateException: Auth scheme is null
        at org.apache.http.util.Asserts.notNull(Asserts.java:52) [209:org.openhab.binding.fritzboxtr064:1.11.0.201710050110]
        at org.apache.http.impl.auth.HttpAuthenticator.ensureAuthScheme(HttpAuthenticator.java:229) [209:org.openhab.binding.fritzboxtr064:1.11.0.201710050110]
        at org.apache.http.impl.auth.HttpAuthenticator.generateAuthResponse(HttpAuthenticator.java:184) [209:org.openhab.binding.fritzboxtr064:1.11.0.201710050110]
        at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:262) [209:org.openhab.binding.fritzboxtr064:1.11.0.201710050110]
        at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184) [209:org.openhab.binding.fritzboxtr064:1.11.0.201710050110]
        at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88) [209:org.openhab.binding.fritzboxtr064:1.11.0.201710050110]
        at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110) [209:org.openhab.binding.fritzboxtr064:1.11.0.201710050110]
        at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184) [209:org.openhab.binding.fritzboxtr064:1.11.0.201710050110]
        at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82) [209:org.openhab.binding.fritzboxtr064:1.11.0.201710050110]
        at org.openhab.binding.fritzboxtr064.internal.Tr064Comm.readSoapResponse(Tr064Comm.java:456) [209:org.openhab.binding.fritzboxtr064:1.11.0.201710050110]
        at org.openhab.binding.fritzboxtr064.internal.Tr064Comm.getTr064Values(Tr064Comm.java:247) [209:org.openhab.binding.fritzboxtr064:1.11.0.201710050110]
        at org.openhab.binding.fritzboxtr064.internal.FritzboxTr064Binding.execute(FritzboxTr064Binding.java:197) [209:org.openhab.binding.fritzboxtr064:1.11.0.201710050110]
        at org.openhab.core.binding.AbstractActiveBinding$BindingActiveService.execute(AbstractActiveBinding.java:144) [178:org.openhab.core.compat1x:2.2.0.201710112009]
        at org.openhab.core.service.AbstractActiveService$RefreshThread.run(AbstractActiveService.java:166) [178:org.openhab.core.compat1x:2.2.0.201710112009]

Expected Behavior

This error is new, as it worked for month before the upgrade. I made an upgrade from openhab2_2.2.0-20170725225428-1_all.deb to openhab2_2.2.0-20171011224825-1. So this behaviour must have been imported in between July and October.

Current Behavior

When this error happens, it doesn't disappear untill a restart of openhab or of the tr064 bundle in karaf. With this error, no actions work (like switch WLAN ON/OFF).

Workaround

Restart openhab or restart tr064 bundle

Steps to Reproduce (for bugs)

I can not reproduce it. It seems to be dependent on the time running this binding.

Your Environment

Debian GNU/Linux 8 openhab2_2.2.0-20171011224825-1 Java(TM) SE Runtime Environment (build 1.8.0_144-b01)

staehler commented 6 years ago

Moved to openhab2-addons (https://github.com/openhab/openhab2-addons/issues/2784)

oprobst commented 6 years ago

Actually I think this project was the right one. The FritzboxTr064 is an openhab 1 binding, because it is able to work with openhab in version one and two.

So if you reopen this issue, I'll send a pull request.

9037568 commented 6 years ago

Reopened, per request.

ghost commented 6 years ago

Still having this issue with Snapshot release from April 14th of 2018.

oprobst commented 6 years ago

Indeed, the error itself still exists, this merge fixes only the re-init of the http connection in case of any exception.

[...] it doesn't disappear untill a restart of openhab or of the tr064 bundle in karaf.

When there is an exception (like a wrong fritzbox call in this case) the connection will be reset and established again. Using the Snapshot release, you will get this error, but afterwards you should be able to request the fritzbox again without restarting openhab (or the Fritzboxr064 plugin).

The actual failure is a wrong (not thread safe) call to the fritzbox. I described (and fixed) it in #5441. The same bug was found earlier (#4548), but the fix these days was not sufficient.

oprobst commented 6 years ago

@hartmood, I fixed this in another ticket, are you interested in testing the fix?

ghost commented 6 years ago

@oprobst Absolutely. Is there a jar I can download or will it be added as a snapshot?

oprobst commented 6 years ago

I simply uploaded it to dropbox: https://www.dropbox.com/s/j29naz1h5mkmc2p/org.openhab.binding.fritzboxtr064-1.12.0-SNAPSHOT.jar?dl=0 Place it in the 'addons' folder and the newer version should be loaded on next startup.

marewe commented 5 years ago

Having the same issue. I loaded it down from your dropbox folder and moved it to the 'addons' folder. But the old binding is still loaded ever after reboot. Deleting temporary and cached filed did not change anything. After another reboot is received this: FrameworkEvent ERROR - org.openhab.binding.fritzboxtr064 org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.fritzboxtr064 [11] Unresolved requirement: Import-Package: org.apache.commons.httpclient.params; version="3.1.0"

and this

Error while starting bundle: file:/usr/share/openhab2/addons/org.openhab.binding.fritzboxtr064-1.12.0-SNAPSHOT.jar org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.fritzboxtr064 [11] Unresolved requirement: Import-Package: org.apache.commons.httpclient.params; version="3.1.0"

What can I do?

FabiJa commented 5 years ago

For me the addon stopped working completly. Error log says Error while executing background thread FritzboxTr064 Refresh Service. java.lang.IllegalStateException: Auth scheme is null I have OH 2.3 running on Openhabian. Restarting of Openhabian and or the Binding itself does not solve the problem.