Kore app keeps reconnecting
#1
Hi all,
I'm new on this forum,

I have a problem with the Kore Official Remote App for Kodi: whenever a content is playing, Kore app keep loose connection. It reconnects, and then loose it again and so on.
When no content is playing everything works fine.

On the same Android device (LG D620) I've Yatse installed and I also have an iPAD with the official XBMC app installed. They're both working without problems.
My goal is to replace Yatse with Kore that looks better to me, but Kore is almost unusable due to this issue.

My environment is: Openlec 5.0.8 on a Raspberry Pi 2 Mod. B (Quad core + 1GB RAM) connected 300Mbps USB LAN adapter.

Any suggestions?
Many thanks in advance and king regards,
Stefano
Reply
#2
Seems like that, for some reason, it can't keep the TCP connection active.

Try this: in Kore go to the server settings and change the TCP port to something that doesn't make sense (like 10932). This will force it to go through HTTP which might solve your issues. There will be a setting in a newer version to do this.
Reply
#3
I see the same thing -- something is very wrong with the network behavior.

In the Android app, when content is playing and I'm on the remote control screen (with the play/FF/pause buttons), the app constantly keeps disconnecting/reconnecting every 2 or 3 seconds.

Beautiful Material Design app otherwise. Smile
Intel i3 Haswell NUC D34010WYK / Yamaha RX-V673 receiver / Panasonic VT-50 plasma TV
Reply
#4
Hi syncd,
thanks for your reply.
I tried to force TCP port on an invalid value (I tried both 10932 and 80000) but the problem is still present.

If you can't reproduce this behaviour on your environmet and you need further investigations on this issue I can do some test for you.
Also, tell me if you need some logs from my system, and I'll send you
Reply
#5
@sstefano75,

I can't reproduce this, and i would need logs from Kore to debug this, but there's no easy way to get them.

Are you able to install a debug version of Kore and get to the logs using ADB (or Android Monitor)?
Reply
#6
@syncd

I can install a debug version of Kore and I can try to get the logs using ADB.
Reply
#7
I can do the same. Where would I find the debug version of Kore?
Intel i3 Haswell NUC D34010WYK / Yamaha RX-V673 receiver / Panasonic VT-50 plasma TV
Reply
#8
(2015-04-14, 14:23)sstefano75 Wrote: @syncd

I can install a debug version of Kore and I can try to get the logs using ADB.

(2015-04-14, 15:36)Alchete Wrote: I can do the same. Where would I find the debug version of Kore?

Thanks. I posted a debug version here: https://drive.google.com/file/d/0B8b8P_p...sp=sharing

You'll need to uninstall the one you have to install this one. After that, just run it to the point of failure and check adb with something like:

Code:
adb logcat | grep `adb shell ps | grep org.xbmc.kore | cut -d " " -f4`

Thanks
Reply
#9
I did the test and here you can find the log file obtained with adb:

https://drive.google.com/file/d/0BwXVSb8...xpc1U/view

Hope this will help

ask me if you need further tests
Reply
#10
Hi syncd,

Here's the relevant error: Unexpected status line, from the HostConnection.readHttpResponse(..) method

It connects, disconnects, and tries again every 3 seconds.

I see the issue on all three of my devices (spanning a wide range of Android):
Nexus 5 - Lollipop 5.1
Nexus 4 - KitKat 4.4.4
Nexus S - 4.1.2

For Kodi -- I'm running:
OpenElec 4.2.1

It seems the okhttp source code has been updated within the past year to be more strict about status line parsing.

Does the Kodi server perhaps begin its response with a leading space?

https://github.com/square/okhttp/issues/1094
https://github.com/square/okhttp/pull/43
https://github.com/square/okhttp/issues/19


Cheers,
Alchete

Code:
04-14 21:49:39.245  15451-15451/org.xbmc.kore D/kore.HostConnectionObserver﹕ Notifying error
04-14 21:49:42.233  15451-15451/org.xbmc.kore D/kore.HostConnectionObserver﹕ Checking whats playing
04-14 21:49:42.234  15451-15451/org.xbmc.kore D/kore.HostConnection﹕ Starting method execute. Method: Player.GetActivePlayers on host: http://192.168.1.6:80/jsonrpc
04-14 21:49:42.249  15451-15808/org.xbmc.kore D/kore.HostConnection﹕ Sending request via HTTP: {"jsonrpc":"2.0","method":"Player.GetActivePlayers","id":87}
04-14 21:49:42.289  15451-15808/org.xbmc.kore W/kore.HostConnection﹕ Failed to read HTTP response.
    java.net.ProtocolException: Unexpected status line:
            at com.android.okhttp.internal.http.StatusLine.<init>(StatusLine.java:38)
            at com.android.okhttp.internal.http.HttpConnection.readResponse(HttpConnection.java:180)
            at com.android.okhttp.internal.http.HttpTransport.readResponseHeaders(HttpTransport.java:101)
            at com.android.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:628)
            at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:388)
            at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:332)
            at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:500)
            at org.xbmc.kore.jsonrpc.HostConnection.readHttpResponse(HostConnection.java:416)
            at org.xbmc.kore.jsonrpc.HostConnection.executeThroughHTTP(HostConnection.java:282)
            at org.xbmc.kore.jsonrpc.HostConnection.access$100(HostConnection.java:49)
            at org.xbmc.kore.jsonrpc.HostConnection$1.run(HostConnection.java:261)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
            at java.lang.Thread.run(Thread.java:818)
04-14 21:49:42.299  15451-15451/org.xbmc.kore D/kore.HostConnectionObserver﹕ Notifying error
Intel i3 Haswell NUC D34010WYK / Yamaha RX-V673 receiver / Panasonic VT-50 plasma TV
Reply
#11
Well, this doesn't look good...

Let's back up a bit. Let's make sure that with TCP there are no issues. In Kore, go into the media center's configuration and make sure that the checkbox "Use TCP" is enabled. Check the TCP port also, which should be 9090, unless you've changed it in Kodi's advancedsettings.xml. Now, check if the issue persists. If it does, go back to the server's settings and check if the previous checkbox is checked. If it's not it couldn't connect trough TCP, probably because of a firewall somewhere. If you can open that port on the firewall.

Now, this doesn't solve the issue, so i'd like to ask you to also tell/check the following:
1. Your android version ant device manufacturer;
2. Kodi's version and OS (with version);
3. A big help would be if someone could use wireshark to check the response that Kodi's webserver is sending back. Ths issue @Alchete mentions might be the reason this is happening.

Thanks
Reply
#12
1. I checkmark TCP.

2. Press "Test".

3. The Settings screen closes.

4. I re-open the Settings screen, and TCP is now unchecked.

It won't stay checked for me. So, I'll try to play with the Firewall -- or more likely, just use Wireshark.


My setup (as posted above)

Kore app running on:
Nexus 5 - Lollipop 5.1
Nexus 4 - KitKat 4.4.4
Nexus S - 4.1.2

OpenElec 4.2.1 (XBMC Gotham 13.2)

All Android devices above show the same behavior. So that tells me the issue isn't likely to be the Android OS.

Common things:
Kore App
XBMC 13.2
My network and other settings (Note -- I'm setting a static IP address for the XBMC/Kodi server)

I can try to run Wireshark tonight and sniff out the return string.
Intel i3 Haswell NUC D34010WYK / Yamaha RX-V673 receiver / Panasonic VT-50 plasma TV
Reply
#13
I did the same as Alchete and I had the same results.

But then I checked my Openelec settings and I've found that under services -> remote control the "allow program on other system to control Kodi" was unchecked.

I activated it and rebooted.

Now the TCP checkbox on Kore works correctly and... the problem is solved!

So I think the problem should be related to the http connection only.
Reply
#14
@syncd : Kodi webserver have lot's of flaws depending on tons of parameters.

System.setProperty("http.keepAlive", "false"); Will help a lot on most roms.

And using real okhttp (2.2 / 2.3 ) solves the last other problems Wink


For TCP, there's no 4 threads to handle things, and there's lot's of blocking calls or very very slow call on rpi that will maybe make you think Kodi does not answer.
Reply
#15
Quote:But then I checked my Openelec settings and I've found that under services -> remote control the "allow program on other system to control Kodi" was unchecked.

Mine was unchecked as well. So far I'm not seeing the problem, but I'm not certain of exactly when it was popping up. Fingers crossed.
Reply

Logout Mark Read Team Forum Stats Members Help
Kore app keeps reconnecting0