openhab-addons: [xmppclient] permanent connection lost after xmpp server was unreachable/restarted
Expected Behavior
If an XMPP Server gets unreachable due to an error or server restart, the binding should connect again after the xmpp server is up again.
Current Behavior
I use a friends xmpp server and it seems it gets rebootet every night. Due to the reboot, the bridge losses its connection and try to connect only one time with a timeout after 5 secs. My only workaround right now is to restart the binding every morning. I know that its not common to restart an xmpp server every night, but this behavoiur should also apear for other people if the connection gets lost for more than 5 secs. In the WebUI the Binding shows itself as online even it is not connected after that connection lost.
Here are some logs during that time:
2021-04-06 06:00:01.801 [WARN ] [oftware.smack.AbstractXMPPConnection] - Connection XMPPTCPConnection[rick_mo@jabber.absturztau.be/XXX] (0) closed with error
org.jivesoftware.smack.XMPPException$StreamErrorException: system-shutdown You can read more about the meaning of this stream error at http://xmpp.org/rfcs/rfc6120.html#streams-error-conditions
<stream:error><system-shutdown xmlns='urn:ietf:params:xml:ns:xmpp-streams'/><text>Received SIGTERM</text></stream:error>
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPConnection.java:1131) ~[?:?]
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$900(XMPPTCPConnection.java:1063) ~[?:?]
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnection.java:1080) ~[?:?]
at java.lang.Thread.run(Thread.java:834) [?:?]
2021-04-06 06:00:01.825 [DEBUG] [nding.xmppclient.internal.XMPPClient] - Connection to XMPP server was lost.
2021-04-06 06:00:01.827 [DEBUG] [nding.xmppclient.internal.XMPPClient] - XMPP connection was closed.
2021-04-06 06:00:06.925 [INFO ] [nding.xmppclient.internal.XMPPClient] - XMPP connection error
org.jivesoftware.smack.SmackException$NoResponseException: No response received within reply timeout. Timeout was 5000ms (~5s). While waiting for establishing TLS
at org.jivesoftware.smack.SmackException$NoResponseException.newWith(SmackException.java:93) ~[bundleFile:4.3.3]
at org.jivesoftware.smack.SynchronizationPoint.checkForResponse(SynchronizationPoint.java:317) ~[bundleFile:4.3.3]
at org.jivesoftware.smack.SynchronizationPoint.checkIfSuccessOrWait(SynchronizationPoint.java:160) ~[bundleFile:4.3.3]
at org.jivesoftware.smack.SynchronizationPoint.checkIfSuccessOrWaitOrThrow(SynchronizationPoint.java:131) ~[bundleFile:4.3.3]
at org.jivesoftware.smack.tcp.XMPPTCPConnection.connectInternal(XMPPTCPConnection.java:944) ~[bundleFile:4.3.3]
at org.jivesoftware.smack.AbstractXMPPConnection.connect(AbstractXMPPConnection.java:417) ~[bundleFile:4.3.3]
at org.openhab.binding.xmppclient.internal.XMPPClient.connectionClosedOnError(XMPPClient.java:149) [bundleFile:?]
at org.jivesoftware.smack.AbstractXMPPConnection.callConnectionClosedOnErrorListener(AbstractXMPPConnection.java:1324) [bundleFile:4.3.3]
at org.jivesoftware.smack.tcp.XMPPTCPConnection.access$800(XMPPTCPConnection.java:154) [bundleFile:4.3.3]
at org.jivesoftware.smack.tcp.XMPPTCPConnection$2$1.run(XMPPTCPConnection.java:991) [bundleFile:4.3.3]
at java.lang.Thread.run(Thread.java:834) [?:?]
Possible Solution
One Solution could be that the connection timeout or some kind of retry limit is configurable Another one would be to try to reconnect every 5 - 15 Minutes
Steps to Reproduce (for Bugs)
- Configure xmpp binding
- Reboot XMPP Server or make it unreachable for more than 5 seconds
Context
My current workaround is to restart the binding every morning via an cronjob. This works pretty well, but yeah daily restarts are not the best solution. Also for other ppl such an timeout/unreachable scenario could happen any time.
Your Environment
- Version: Docker Image: openhab/openhab:3.0.1
- Addon: binding-xmppclient 3.0.1
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 1
- Comments: 15 (9 by maintainers)
Hello all, I have a similar issue here. After rebooting my Ubuntu server, the xmpp binding sometimes has problems in DNS resolving. Instead of retrying after some time, it shuts down itself. In this case, the xmpp binding is not useable until restarting it. It would be nice, if the binding tries to reconnect after some time.
2021-08-30 01:12:35.255 [INFO ] [org.openhab.ui.internal.UIService ] - Started UI on port 80802021-08-30 01:12:41.191 [INFO ] [e.automation.internal.RuleEngineImpl] - Rule engine started.2021-08-30 01:12:45.819 [INFO ] [internal.ModuleHandlerFactoryStarter] - WebPushNotificationModuleHandlerFactory started by ModuleHandlerFactoryStarter2021-08-30 01:12:46.154 [INFO ] [hab.ui.habot.tile.internal.HABotTile] - Started HABot at /habot2021-08-30 01:12:46.282 [INFO ] [ab.ui.habpanel.internal.HABPanelTile] - Started HABPanel at /habpanel2021-08-30 01:12:46.452 [WARN ] [software.smack.tcp.XMPPTCPConnection] - shutdownjava.lang.NullPointerException: nullat org.jivesoftware.smack.tcp.XMPPTCPConnection.shutdown(XMPPTCPConnection.java:538) [bundleFile:4.3.3]at org.jivesoftware.smack.tcp.XMPPTCPConnection.instantShutdown(XMPPTCPConnection.java:507) [bundleFile:4.3.3]at org.jivesoftware.smack.AbstractXMPPConnection.connect(AbstractXMPPConnection.java:426) [bundleFile:4.3.3]at org.openhab.binding.xmppclient.internal.XMPPClient.connect(XMPPClient.java:87) [bundleFile:?]at org.openhab.binding.xmppclient.internal.handler.XMPPClientHandler.doConnect(XMPPClientHandler.java:90) [bundleFile:?]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:834) [?:?]2021-08-30 01:12:46.471 [INFO ] [t.internal.handler.XMPPClientHandler] - XMPP connection error org.jivesoftware.smack.SmackException$ConnectionException: The following addresses failed: 'gruenbaer.net:5222' failed because: java.net.UnknownHostException: gruenbaer.net: Temporary failure in name res olutionat org.jivesoftware.smack.SmackException$ConnectionException.from(SmackException.java:292) ~[bundleFile:4.3.3]at org.jivesoftware.smack.tcp.XMPPTCPConnection.connectUsingConfiguratio n(XMPPTCPConnection.java:658) ~[bundleFile:4.3.3]at org.jivesoftware.smack.tcp.XMPPTCPConnection.connectInternal(XMPPTCPConnection.java:938) ~[bundleFile:4.3.3]at org.jivesoftware.smack.AbstractXMPPConnection.connect(AbstractXMPPConnection.java:417) ~[bundleFile:4.3.3]at org.openhab.binding.xmppclient.internal.XMPPClient.connect(XMPPClient.java:87) ~[bundleFile:?]at org.openhab.binding.xmppclient.internal.handler.XMPPClientHandler.doConnect(XMPPClientHandler.java:90) [bundleFile:?]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:834) [?:?]2021-08-30 01:42:45.017 [WARN ] [jivesoftware.smackx.ping.PingManager] - XMPPConnection was not authenticated