carille
03/03/2025, 6:48 PMio.ktor.client.network.sockets.SocketTimeoutException: Socket timeout has expired [url=<http://192.168.4.1:3331/firmware_upgrade>, socket_timeout=unknown] ms
is this timeout from the client side or the server side?
Here's the config
actual fun httpClient(config: HttpClientConfig<*>.() -> Unit) = HttpClient(OkHttp) {
install(Logging) {
level = LogLevel.ALL
logger = Logger.DEFAULT
}
install(HttpTimeout) {
requestTimeoutMillis = 60000
connectTimeoutMillis = 60000
socketTimeoutMillis = 60000
}
config(this)
engine {
// this: OkHttpConfig
config {
retryOnConnectionFailure(true)
}
}
}
carille
03/03/2025, 6:48 PM2025-03-03 11:18:37.201 19051-25449 System.err com.company.test W io.ktor.client.network.sockets.SocketTimeoutException: Socket timeout has expired [url=<http://192.168.4.1:3331/firmware_upgrade>, socket_timeout=unknown] ms
2025-03-03 11:18:37.201 19051-25449 System.err com.company.test W at io.ktor.client.plugins.HttpTimeoutKt.SocketTimeoutException(HttpTimeout.kt:239)
2025-03-03 11:18:37.201 19051-25449 System.err com.company.test W at io.ktor.client.engine.okhttp.OkUtilsKt.mapOkHttpException(OkUtils.kt:80)
2025-03-03 11:18:37.201 19051-25449 System.err com.company.test W at io.ktor.client.engine.okhttp.OkUtilsKt.access$mapOkHttpException(OkUtils.kt:1)
2025-03-03 11:18:37.201 19051-25449 System.err com.company.test W at io.ktor.client.engine.okhttp.OkHttpCallback.onFailure(OkUtils.kt:39)
2025-03-03 11:18:37.201 19051-25449 System.err com.company.test W at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:525)
2025-03-03 11:18:37.201 19051-25449 System.err com.company.test W at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
2025-03-03 11:18:37.201 19051-25449 System.err com.company.test W at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
2025-03-03 11:18:37.201 19051-25449 System.err com.company.test W at java.lang.Thread.run(Thread.java:923)
2025-03-03 11:18:37.202 19051-25449 System.err com.company.test W Caused by: java.net.SocketTimeoutException: timeout
2025-03-03 11:18:37.202 19051-25449 System.err com.company.test W at okio.SocketAsyncTimeout.newTimeoutException(JvmOkio.kt:146)
2025-03-03 11:18:37.202 19051-25449 System.err com.company.test W at okio.AsyncTimeout.access$newTimeoutException(AsyncTimeout.kt:186)
2025-03-03 11:18:37.202 19051-25449 System.err com.company.test W at okio.AsyncTimeout$source$1.read(AsyncTimeout.kt:390)
2025-03-03 11:18:37.202 19051-25449 System.err com.company.test W at okio.RealBufferedSource.indexOf(RealBufferedSource.kt:455)
2025-03-03 11:18:37.202 19051-25449 System.err com.company.test W at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.kt:348)
2025-03-03 11:18:37.202 19051-25449 System.err com.company.test W at okhttp3.internal.http1.HeadersReader.readLine(HeadersReader.kt:29)
2025-03-03 11:18:37.202 19051-25449 System.err com.company.test W at okhttp3.internal.http1.Http1ExchangeCodec.readResponseHeaders(Http1ExchangeCodec.kt:178)
2025-03-03 11:18:37.202 19051-25449 System.err com.company.test W at okhttp3.internal.connection.Exchange.readResponseHeaders(Exchange.kt:106)
2025-03-03 11:18:37.202 19051-25449 System.err com.company.test W at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.kt:79)
2025-03-03 11:18:37.202 19051-25449 System.err com.company.test W at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
2025-03-03 11:18:37.202 19051-25449 System.err com.company.test W at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:34)
2025-03-03 11:18:37.202 19051-25449 System.err com.company.test W at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
2025-03-03 11:18:37.202 19051-25449 System.err com.company.test W at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:95)
2025-03-03 11:18:37.202 19051-25449 System.err com.company.test W at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
2025-03-03 11:18:37.202 19051-25449 System.err com.company.test W at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:83)
2025-03-03 11:18:37.202 19051-25449 System.err com.company.test W at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
2025-03-03 11:18:37.202 19051-25449 System.err com.company.test W at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:76)
2025-03-03 11:18:37.202 19051-25449 System.err com.company.test W at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
2025-03-03 11:18:37.202 19051-25449 System.err com.company.test W at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201)
2025-03-03 11:18:37.202 19051-25449 System.err com.company.test W at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:517)
2025-03-03 11:18:37.202 19051-25449 System.err com.company.test W ... 3 more
2025-03-03 11:18:37.202 19051-25449 System.err com.company.test W Caused by: java.net.SocketException: Socket closed
2025-03-03 11:18:37.202 19051-25449 System.err com.company.test W at java.net.SocketInputStream.read(SocketInputStream.java:209)
2025-03-03 11:18:37.202 19051-25449 System.err com.company.test W at java.net.SocketInputStream.read(SocketInputStream.java:144)
2025-03-03 11:18:37.202 19051-25449 System.err com.company.test W at okio.InputStreamSource.read(JvmOkio.kt:93)
2025-03-03 11:18:37.202 19051-25449 System.err com.company.test W at okio.AsyncTimeout$source$1.read(AsyncTimeout.kt:153)
Aleksei Tirman [JB]
03/04/2025, 12:18 PMSocketTimeoutException
was thrown because the socket had been closed.carille
03/10/2025, 3:33 PMsocketTimeout
override?Aleksei Tirman [JB]
03/11/2025, 8:39 AMcarille
03/11/2025, 3:50 PMAleksei Tirman [JB]
03/12/2025, 8:17 AMsocketTimeoutMillis
from the HttpTimeout plugin.carille
03/13/2025, 6:29 PMinstall(HttpTimeout) {
requestTimeoutMillis = 5 * 60 * 1000 // 5 minutes
connectTimeoutMillis = 2 * 60 * 1000 // 2 minutes
socketTimeoutMillis = 5 * 60 * 1000 // 5 minutes
}
Aleksei Tirman [JB]
03/14/2025, 8:55 AMcarille
03/14/2025, 3:54 PMcarille
03/18/2025, 7:23 PM