java.net.SocketTimeoutException with no lines referencing my code
See original GitHub issueKtor Version and Engine Used (client or server and name)
- io.ktor:ktor-client-core:1.2.3-rc
- io.ktor:ktor-client-core-jvm:1.2.3-rc
- io.ktor:ktor-client-okhttp:1.2.3-rc
Describe the bug See the exception below. This exception is reported by Firebase. I can not reproduce it myself although quite some users appear to get this bug. I have no idea where this happens in my code and that is why I am unable to fix it myself. It looks like some sort of timeout error.
Fatal Exception: java.net.SocketTimeoutException: timeout
at okio.SocketAsyncTimeout.newTimeoutException + 159(SocketAsyncTimeout.java:159)
at okio.AsyncTimeout.exit$jvm + 203(AsyncTimeout.java:203)
at okio.AsyncTimeout$source$1.read + 163(AsyncTimeout.java:163)
at okio.RealBufferedSource.read + 41(RealBufferedSource.java:41)
at okhttp3.internal.http1.Http1ExchangeCodec$AbstractSource.read + 352(Http1ExchangeCodec.java:352)
at okhttp3.internal.http1.Http1ExchangeCodec$UnknownLengthSource.read + 488(Http1ExchangeCodec.java:488)
at okhttp3.internal.connection.Exchange$ResponseBodySource.read + 279(Exchange.java:279)
at okio.RealBufferedSource.read + 41(RealBufferedSource.java:41)
at okhttp3.internal.cache.CacheInterceptor$cacheWritingResponse$cacheWritingSource$1.read + 158(CacheInterceptor.java:158)
at okio.RealBufferedSource.read + 148(RealBufferedSource.java:148)
at io.ktor.client.engine.okhttp.OkHttpEngineKt$toChannel$1$1$1.invoke + 97(OkHttpEngineKt.java:97)
at io.ktor.client.engine.okhttp.OkHttpEngineKt$toChannel$1$1$1.invoke(OkHttpEngineKt.java:1)
at kotlinx.coroutines.io.ByteBufferChannel.write + 1508(ByteBufferChannel.java:1508)
at kotlinx.coroutines.io.ByteWriteChannel$DefaultImpls.write$default + 84(ByteWriteChannel.java:84)
at io.ktor.client.engine.okhttp.OkHttpEngineKt$toChannel$1.invokeSuspend + 96(OkHttpEngineKt.java:96)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith + 33(BaseContinuationImpl.java:33)
at kotlinx.coroutines.DispatchedTask.run + 241(DispatchedTask.java:241)
at java.util.concurrent.ThreadPoolExecutor.runWorker + 1167(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run + 641(ThreadPoolExecutor.java:641)
at java.lang.Thread.run + 764(Thread.java:764)
Caused by java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(SocketInputStream.java)
at java.net.SocketInputStream.socketRead + 119(SocketInputStream.java:119)
at java.net.SocketInputStream.read + 176(SocketInputStream.java:176)
at java.net.SocketInputStream.read + 144(SocketInputStream.java:144)
at okio.InputStreamSource.read + 102(InputStreamSource.java:102)
at okio.AsyncTimeout$source$1.read + 159(AsyncTimeout.java:159)
at okio.RealBufferedSource.read + 41(RealBufferedSource.java:41)
at okhttp3.internal.http1.Http1ExchangeCodec$AbstractSource.read + 352(Http1ExchangeCodec.java:352)
at okhttp3.internal.http1.Http1ExchangeCodec$UnknownLengthSource.read + 488(Http1ExchangeCodec.java:488)
at okhttp3.internal.connection.Exchange$ResponseBodySource.read + 279(Exchange.java:279)
at okio.RealBufferedSource.read + 41(RealBufferedSource.java:41)
at okhttp3.internal.cache.CacheInterceptor$cacheWritingResponse$cacheWritingSource$1.read + 158(CacheInterceptor.java:158)
at okio.RealBufferedSource.read + 148(RealBufferedSource.java:148)
at io.ktor.client.engine.okhttp.OkHttpEngineKt$toChannel$1$1$1.invoke + 97(OkHttpEngineKt.java:97)
at io.ktor.client.engine.okhttp.OkHttpEngineKt$toChannel$1$1$1.invoke(OkHttpEngineKt.java:1)
at kotlinx.coroutines.io.ByteBufferChannel.write + 1508(ByteBufferChannel.java:1508)
at kotlinx.coroutines.io.ByteWriteChannel$DefaultImpls.write$default + 84(ByteWriteChannel.java:84)
at io.ktor.client.engine.okhttp.OkHttpEngineKt$toChannel$1.invokeSuspend + 96(OkHttpEngineKt.java:96)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith + 33(BaseContinuationImpl.java:33)
at kotlinx.coroutines.DispatchedTask.run + 241(DispatchedTask.java:241)
at java.util.concurrent.ThreadPoolExecutor.runWorker + 1167(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run + 641(ThreadPoolExecutor.java:641)
at java.lang.Thread.run + 764(Thread.java:764)
To Reproduce As the stacktrace shows no lines of my code I do not know how to reproduce it. I would really appreciate some help for this exception. I am not entirely sure if this is related to Ktor, but thought this would be the best place to report it. I have Kotlin Coroutines debug mode enabled as well.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:8
- Comments:21 (6 by maintainers)
Top Results From Across the Web
java.net.SocketTimeoutException with no lines referencing ...
I have no idea where this happens in my code and that is why I am unable to fix it myself. It looks...
Read more >android - java.net.SocketTimeoutException: timeout
I am getting this exception within 10 seconds, even my socket timeout( readTimeout ) value is much higher. It is consistently failing for...
Read more >How to resolve java.net.SocketTimeoutException
Your Java socket is timing out means that it takes too long to get respond from other device and your request expires before...
Read more >'Read timed out', seen during SyncNode request
Issuing a syncNode request from the node (nodehost.domain.com) such as, > syncNode.sh ... msg=Read timed out; targetException=java.net.
Read more >Known Issues for JDK 8
If there are network connection problems, such as when a proxy is turned off, the revocation check can take a long time, before...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We are also experiencing a similar problem (using 1.2.5):
I wrote a repro case using the current prerelease version
1.3-beta1
(1.2
has the same issue). Not usingSocketTimeoutException
butConnectionRefused
because it is easier to cause, but behaviour should be the same: https://github.com/luqasn/ktor-httpclient-exception-repro