[SOLVED] Chromecast binding freezes openHab?

Dear Community!

As I have stated earlier, I have problems with the stability of openHab.
As I was trying to figure at what causes the issue, it seems that most of the time, stops at this error:

2018-06-04 06:56:42.975 [WARN ] [su.litvak.chromecast.api.v2.Channel ] - Error while reading
su.litvak.chromecast.api.v2.ChromeCastException: Remote socket closed
	at su.litvak.chromecast.api.v2.Channel.read(Channel.java:413) [217:org.openhab.binding.chromecast:2.3.0]
	at su.litvak.chromecast.api.v2.Channel.access$200(Channel.java:50) [217:org.openhab.binding.chromecast:2.3.0]
	at su.litvak.chromecast.api.v2.Channel$ReadThread.run(Channel.java:132) [217:org.openhab.binding.chromecast:2.3.0]
2018-06-04 06:56:42.980 [WARN ] [su.litvak.chromecast.api.v2.Channel ] - Error while sending 'PING'
java.net.SocketException: Connection closed by remote host
	at sun.security.ssl.SSLSocketImpl.checkWrite(SSLSocketImpl.java:1565) [?:?]
	at sun.security.ssl.AppOutputStream.write(AppOutputStream.java:71) [?:?]
	at java.io.OutputStream.write(OutputStream.java:75) [?:?]
	at su.litvak.chromecast.api.v2.Channel.write(Channel.java:401) [217:org.openhab.binding.chromecast:2.3.0]
	at su.litvak.chromecast.api.v2.Channel.write(Channel.java:397) [217:org.openhab.binding.chromecast:2.3.0]
	at su.litvak.chromecast.api.v2.Channel.write(Channel.java:384) [217:org.openhab.binding.chromecast:2.3.0]
	at su.litvak.chromecast.api.v2.Channel.access$000(Channel.java:50) [217:org.openhab.binding.chromecast:2.3.0]
	at su.litvak.chromecast.api.v2.Channel$PingThread.run(Channel.java:114) [217:org.openhab.binding.chromecast:2.3.0]
	at java.util.TimerThread.mainLoop(Timer.java:555) [?:?]
	at java.util.TimerThread.run(Timer.java:505) [?:?]
2018-06-04 06:56:53.098 [WARN ] [su.litvak.chromecast.api.v2.Channel ] -  <--  null payload in message 
2018-06-04 06:57:13.541 [WARN ] [su.litvak.chromecast.api.v2.Channel ] - Error while sending 'PING'
java.net.SocketException: Connection closed by remote host
	at sun.security.ssl.SSLSocketImpl.checkWrite(SSLSocketImpl.java:1565) [?:?]
	at sun.security.ssl.AppOutputStream.write(AppOutputStream.java:71) [?:?]
	at java.io.OutputStream.write(OutputStream.java:75) [?:?]
	at su.litvak.chromecast.api.v2.Channel.write(Channel.java:401) [217:org.openhab.binding.chromecast:2.3.0]
	at su.litvak.chromecast.api.v2.Channel.write(Channel.java:397) [217:org.openhab.binding.chromecast:2.3.0]
	at su.litvak.chromecast.api.v2.Channel.write(Channel.java:384) [217:org.openhab.binding.chromecast:2.3.0]
	at su.litvak.chromecast.api.v2.Channel.access$000(Channel.java:50) [217:org.openhab.binding.chromecast:2.3.0]
	at su.litvak.chromecast.api.v2.Channel$PingThread.run(Channel.java:114) [217:org.openhab.binding.chromecast:2.3.0]
	at java.util.TimerThread.mainLoop(Timer.java:555) [?:?]
	at java.util.TimerThread.run(Timer.java:505) [?:?]

Is this possible that Chromecast binding has some issue? Someone who also encountered this issue?
I’m on 2.3.0 stable and it seems that there is much much less freezes than on 2.2.0. However this can happen daily, so not very convenient…

1 Like

Yes, I have the same messages whenever I stop openHAB.
I used to have problems with the chromecast binding until I discovered that the chromecast goes to sleep after a while. So I installed the Network Binding and I ping the chromecast every minute. That keeps it awake and the problems are gone.

Thanks I’ll try these

How do you setup timed pinging with the Network binding?

PaperUI
Configuration
Things
Edit (Pen icon top left)
Change refresh interval (60000ms default) = 1 minute

Oh thanks, I never thought of this! I thought that I have to write a rule for it!

Thanks!

No problems, let me know if your chromecast problem is gone after that. Thanks

I will monitor this now!
Hope this fixes my issue, because this was one of the first things which I integrated into openHab and I have this kind of problem since then…

It seemed that it solved the problem, until now… However my original post is 9 days old, so it worked much longer time than before (it usually stopped after a few days, 1-2-3 days)

This is the end of the log where it stopped:

2018-06-15 06:39:33.504 [WARN ] [su.litvak.chromecast.api.v2.Channel ] - Error while reading
javax.net.ssl.SSLException: Connection has been shutdown: javax.net.ssl.SSLException: java.net.SocketException: Broken pipe (Write failed)
	at sun.security.ssl.SSLSocketImpl.checkEOF(SSLSocketImpl.java:1551) [?:?]
	at sun.security.ssl.AppInputStream.read(AppInputStream.java:95) [?:?]
	at sun.security.ssl.AppInputStream.read(AppInputStream.java:71) [?:?]
	at su.litvak.chromecast.api.v2.Channel.read(Channel.java:411) [217:org.openhab.binding.chromecast:2.3.0]
	at su.litvak.chromecast.api.v2.Channel.access$200(Channel.java:50) [217:org.openhab.binding.chromecast:2.3.0]
	at su.litvak.chromecast.api.v2.Channel$ReadThread.run(Channel.java:132) [217:org.openhab.binding.chromecast:2.3.0]
Caused by: javax.net.ssl.SSLException: java.net.SocketException: Broken pipe (Write failed)
	at sun.security.ssl.Alerts.getSSLException(Alerts.java:208) ~[?:?]
	at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1959) ~[?:?]
	at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1916) ~[?:?]
	at sun.security.ssl.SSLSocketImpl.handleException(SSLSocketImpl.java:1880) ~[?:?]
	at sun.security.ssl.SSLSocketImpl.handleException(SSLSocketImpl.java:1825) ~[?:?]
	at sun.security.ssl.AppOutputStream.write(AppOutputStream.java:128) ~[?:?]
	at java.io.OutputStream.write(OutputStream.java:75) ~[?:?]
	at su.litvak.chromecast.api.v2.Channel.write(Channel.java:401) ~[?:?]
	at su.litvak.chromecast.api.v2.Channel.write(Channel.java:397) ~[?:?]
	at su.litvak.chromecast.api.v2.Channel.write(Channel.java:384) ~[?:?]
	at su.litvak.chromecast.api.v2.Channel.access$000(Channel.java:50) ~[?:?]
	at su.litvak.chromecast.api.v2.Channel$ReadThread.run(Channel.java:191) ~[?:?]
Caused by: java.net.SocketException: Broken pipe (Write failed)
	at java.net.SocketOutputStream.socketWrite0(Native Method) ~[?:?]
	at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:111) ~[?:?]
	at java.net.SocketOutputStream.write(SocketOutputStream.java:155) ~[?:?]
	at sun.security.ssl.OutputRecord.writeBuffer(OutputRecord.java:431) ~[?:?]
	at sun.security.ssl.OutputRecord.write(OutputRecord.java:417) ~[?:?]
	at sun.security.ssl.SSLSocketImpl.writeRecordInternal(SSLSocketImpl.java:886) ~[?:?]
	at sun.security.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:857) ~[?:?]
	at sun.security.ssl.AppOutputStream.write(AppOutputStream.java:123) ~[?:?]
	at java.io.OutputStream.write(OutputStream.java:75) ~[?:?]
	at su.litvak.chromecast.api.v2.Channel.write(Channel.java:401) ~[?:?]
	at su.litvak.chromecast.api.v2.Channel.write(Channel.java:397) ~[?:?]
	at su.litvak.chromecast.api.v2.Channel.write(Channel.java:384) ~[?:?]
	at su.litvak.chromecast.api.v2.Channel.access$000(Channel.java:50) ~[?:?]
	at su.litvak.chromecast.api.v2.Channel$ReadThread.run(Channel.java:191) ~[?:?]
2018-06-15 06:39:33.929 [WARN ] [su.litvak.chromecast.api.v2.Channel ] -  <--  null payload in message 
2018-06-15 06:40:09.570 [WARN ] [me.core.internal.events.EventHandler] - Dispatching event to subscriber 'org.eclipse.smarthome.model.rule.runtime.internal.engine.RuleEngineImpl@136110e' takes more than 5000ms.
2018-06-15 06:40:11.517 [INFO ] [e.smarthome.model.script.radio.rules] - Received command: classHit
2018-06-15 06:40:17.748 [INFO ] [e.smarthome.model.script.radio.rules] - Received command: classHit
2018-06-15 06:40:40.697 [WARN ] [me.core.internal.events.EventHandler] - Dispatching event to subscriber 'org.openhab.io.openhabcloud.internal.CloudService@16167e6' takes more than 5000ms.

It looks like it’s not just chromecast having a problem

How do you came to this conclusion?
Which lines seems to you that anything else causes some issue? Any idea to find these bugs and eliminate them?

Thanks

The last line, it looks like the whole ssl systemhas gone down

I have opened an issue on Github, because I haven’t found any relevant info on this and for me it seems that the Chromecast binding causes this issue. I had several freezes since then and it always happened when the log produced the same output. Chromecast exception, these warning on the last lines and after that the whole openhab freezes.

@vzorglub Vincent,

I’m going to give your workaround a try. I would love it if this works out! I have it in place but it seems that I am still seeing Chromecast binding errors in the log.

I have added a Network binding ping for the “physical” Chromecasts. But I also have two Chromecast audio groups. The log does not give information on which Chromecast generated the error (if it does, I haven’t been able to decipher it). I wonder if there’s a similar narcolepsy issue with audio groups? If so, I don’t know of a way to keep them “awake”.

@Kai - if this is a “fix” for the problem, I wonder if there is a way to add this periodic ping directly to the Chromecast binding? Or, perhaps, if the binding is made aware that the devices are prone to going idle, the binding will treat these errors differently? Perhaps a WARNING rather than an ERROR and with a much less verbose log?

Regards.

Mike

Decided to post a new question.

Maybe hoping on to this older “solved” topic is a recipe for “silence”. Hopefully some traction for a new topic.

I have defined the google speaker in items file.
Please tell, how can i define if this reftresh interval in it?

PS
I thing found in Rest Api - right Screenshot by Lightshot ?