xbmc / Kore

Kore is a simple and easy-to-use Kodi remote.
Apache License 2.0
643 stars 244 forks source link

Timeout when updating the Movie list #1021

Open asirinelli opened 3 months ago

asirinelli commented 3 months ago

Bug report

Describe the bug

When updating the movie list, the action fails with a message "Unable to connect to media center" (unable_to_connect_to_xbmc).

Expected Behavior

Update the list of movies.

Actual Behavior

Error message and the list of movies is not updated.

Possible Fix

This patch solve the issue:

diff --git a/app/src/main/java/org/xbmc/kore/host/HostConnection.java b/app/src/main/java/org/xbmc/kore/host/HostConnection.java
index 06d756ab..b24dcb0b 100644
--- a/app/src/main/java/org/xbmc/kore/host/HostConnection.java
+++ b/app/src/main/java/org/xbmc/kore/host/HostConnection.java
@@ -524,6 +524,7 @@ public class HostConnection {
         if (httpClient == null) {
             httpClient = new OkHttpClient.Builder()
                     .connectTimeout(connectTimeout, TimeUnit.MILLISECONDS)
+                    .readTimeout(60, TimeUnit.SECONDS)
                     .authenticator(getOkHttpAuthenticator())
                     .build();
         }

Debuglog

The debuglog can be found here:

05-18 18:01:32.464 32492 32558 W HostConnection: Failed to send OkHttp request.
05-18 18:01:32.464 32492 32558 W HostConnection: java.net.SocketTimeoutException: timeout
05-18 18:01:32.464 32492 32558 W HostConnection:    at okio.SocketAsyncTimeout.newTimeoutException(Unknown Source:4)
05-18 18:01:32.464 32492 32558 W HostConnection:    at okio.AsyncTimeout.access$newTimeoutException(Unknown Source:0)
05-18 18:01:32.464 32492 32558 W HostConnection:    at okio.AsyncTimeout$source$1.read(Unknown Source:39)
05-18 18:01:32.464 32492 32558 W HostConnection:    at okio.RealBufferedSource.indexOf(SourceFile:0)
05-18 18:01:32.464 32492 32558 W HostConnection:    at okio.RealBufferedSource.readUtf8LineStrict(SourceFile:0)
05-18 18:01:32.464 32492 32558 W HostConnection:    at okhttp3.internal.http1.HeadersReader.readLine(Unknown Source:4)
05-18 18:01:32.464 32492 32558 W HostConnection:    at okhttp3.internal.http1.Http1ExchangeCodec.readResponseHeaders(Unknown Source:22)
05-18 18:01:32.464 32492 32558 W HostConnection:    at okhttp3.internal.connection.Exchange.readResponseHeaders(Unknown Source:2)
05-18 18:01:32.464 32492 32558 W HostConnection:    at okhttp3.internal.http.CallServerInterceptor.intercept(Unknown Source:169)
05-18 18:01:32.464 32492 32558 W HostConnection:    at okhttp3.internal.http.RealInterceptorChain.proceed(Unknown Source:162)
05-18 18:01:32.464 32492 32558 W HostConnection:    at okhttp3.internal.connection.ConnectInterceptor.intercept(Unknown Source:32)
05-18 18:01:32.464 32492 32558 W HostConnection:    at okhttp3.internal.http.RealInterceptorChain.proceed(Unknown Source:162)
05-18 18:01:32.464 32492 32558 W HostConnection:    at okhttp3.internal.cache.CacheInterceptor.intercept(Unknown Source:189)
05-18 18:01:32.464 32492 32558 W HostConnection:    at okhttp3.internal.http.RealInterceptorChain.proceed(Unknown Source:162)
05-18 18:01:32.464 32492 32558 W HostConnection:    at okhttp3.internal.http.BridgeInterceptor.intercept(Unknown Source:167)
05-18 18:01:32.464 32492 32558 W HostConnection:    at okhttp3.internal.http.RealInterceptorChain.proceed(Unknown Source:162)
05-18 18:01:32.464 32492 32558 W HostConnection:    at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(Unknown Source:34)
05-18 18:01:32.464 32492 32558 W HostConnection:    at okhttp3.internal.http.RealInterceptorChain.proceed(Unknown Source:162)
05-18 18:01:32.464 32492 32558 W HostConnection:    at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(Unknown Source:113)
05-18 18:01:32.464 32492 32558 W HostConnection:    at okhttp3.internal.connection.RealCall.execute(Unknown Source:27)
05-18 18:01:32.464 32492 32558 W HostConnection:    at org.xbmc.kore.host.HostConnection.sendOkHttpRequest(Unknown Source:5)
05-18 18:01:32.464 32492 32558 W HostConnection:    at org.xbmc.kore.host.HostConnection.executeThroughOkHttp(Unknown Source:37)
05-18 18:01:32.464 32492 32558 W HostConnection:    at org.xbmc.kore.host.HostConnection.lambda$execute$0(Unknown Source:10)
05-18 18:01:32.464 32492 32558 W HostConnection:    at org.xbmc.kore.host.HostConnection.$r8$lambda$nGvPyzIRT5NlcWSN9SBVz_iLQyk(SourceFile:0)
05-18 18:01:32.464 32492 32558 W HostConnection:    at org.xbmc.kore.host.HostConnection$$ExternalSyntheticLambda0.run(SourceFile:0)
05-18 18:01:32.464 32492 32558 W HostConnection:    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
05-18 18:01:32.464 32492 32558 W HostConnection:    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
05-18 18:01:32.464 32492 32558 W HostConnection:    at java.lang.Thread.run(Thread.java:1012)
05-18 18:01:32.464 32492 32558 W HostConnection: Caused by: java.net.SocketException: Socket closed
05-18 18:01:32.464 32492 32558 W HostConnection:    at java.net.SocketInputStream.read(SocketInputStream.java:188)
05-18 18:01:32.464 32492 32558 W HostConnection:    at java.net.SocketInputStream.read(SocketInputStream.java:143)
05-18 18:01:32.464 32492 32558 W HostConnection:    at okio.InputStreamSource.read(Unknown Source:45)
05-18 18:01:32.464 32492 32558 W HostConnection:    at okio.AsyncTimeout$source$1.read(Unknown Source:12)
05-18 18:01:32.464 32492 32558 W HostConnection:    ... 25 more

Your Environment

Used Operating system: