openhab-addons: [pushover] Sending messages randomly fails with java.io.EOFException

Expected Behavior

Pushover messages should be reliable. Every attempt of sending a message from a rule should bring the same result.

Current Behavior

Very randomly and for no good reason the following error message appears in the logs and no pushover message is sent:

Script execution of rule with UID 'hm-sonstige-5' failed: java.io.EOFException: HttpConnectionOverHTTP@d761b68::DecryptedEndPoint@3b78ddb9{api.pushover.net/104.20.125.71:443<->/192.168.178.2:47218,OPEN,fill=-,flush=F,to=82112373/0} in hm-sonstige

Seconds later the exact same rule works like a charm for multiple times.

Steps to Reproduce (for Bugs)

Send a pushover message from the same rule multiple times.

Your Environment

  • Version used: openHAB 3.1.0.M2
  • Operating System and version: Synology Docker Container

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 62 (41 by maintainers)

Most upvoted comments

  1. Per configuration; Didn’t think of this option, nice one, could be feasable. Not entirely sure if it would be worth the effort. Would you expect that users who experience the issue would know how to fix this without support?

No, so perhaps we could default to the 18, and let 0 keep the default idle timeout. I can’t say if it’s worth it, but personally I would probably use idleTimeout=0 since I never had any issues, and don’t see a reason not to reuse connections. Would you expect any issues if timeout is configured to be higher than idle timeout? Since timeout is configurable already, it would be strange to have idle timeout hardcoded if the two values have any relation.

There is no relation, idletimeout and timeout control different parts without overlap.

If you don’t think any of this is worth to do, we can also merge it in its current state.

I’ll come back to this. Bit busy these days.

o it seems we are doing blocking HTTP calls ad-hoc with 10 s timeout (default value at least) and not keeping any persistent connection. What causes the EOF exception, and how did you come up with 18 s as idle value? It seems like the default value for the shared client

It took me a while to get it fixed.

The EOF is caused by the httpclient while sending the request. The underlying connection seems no longer to be available, but the httpclient is not aware. The connection might be killed by anything in between the httpclient and the remote server (including the remote server self, firewall, routers, anything)

As of HTTP 1.1 the connection is kept alive by default. The Jetty client can be manipulated to control the idle time by setting httpClient.setIdleTimeout(); As it failed reproducable after 5 minutes, i set the idletimeout to a shorter time, i just choose 18 seconds, but it might also work with 3 minutes or any other value < 5 minutes. Pushover binding does not use a periodic call, so i could not choose this interval + some offeset. The binding sends messagtes ad-hoc, so i assumed most messages are send close together or with some longer time in between. I do not care that much about the exact value as there is little to no advantage to stretch this value to the max.

The thought behind this is that the httpclient does know when the idle timeout occurs and it handles it transparantly. As long as this timeout triggers before the ‘remote connection kill’ event is happening, it all works.

BTW: i ruled out the other bindings by first trying to use httpClientFactory.createHttpClient("binding.pushover"); but that did not help at all. You can see that in the commit history.

Hope this explains it enough to merge the request.

Nice! I have updated the jar again. Would be nice if you can test once more. I did some cleanup and had a closer look at the documentation so it should still work, but with less code change.

Updated the JAR, now it includes some more timeout restrictions. Curious if that makes a difference. most of them are set around 2 minute mark.

Hi! I ran into the same Problem! Some messages went out and some not. What i saw is that after a fresh reboot every message went out. But after some time when no message was sent the next message generates an EOF Exception. I observed this after i got a new Cable Modem from my Internet Provider. So i started to dig deeper. What i found out:

  1. After a fresh reboot the Binding opens a TLS Connection to api.pushover.net
  2. Trigering some Pushover Rules in OpenHAB -> Messages are all sent!
  3. Then I waited some Time and observed the Network Traffic via TCP Dump
  4. I saw that the HTTPS Connection is not closed by the Binding and there is no Traffic on this connection (Keepalives)
  5. My Cable Modem at some point Kills the Session the hard way and unfortunately not telling this to the Client (openHAB Server) via the TCP Stack
  6. The next Message which a rule want to sent will fail
  7. The Binding opens a new TLS Connection to api.pushover.net

Workaround: Triggering a “Sent Message” with Empty Content every couple of Minutes will generate some “Keepalive” Traffic on the established Connection and my Cable Modem is not Dropping the Connection!

Is it possible to implement some sort of Keepalive in the Binding or a check if an established TCP Session is “healthy”?