kittinunf / fuel

The easiest HTTP networking library for Kotlin/Android

Home Page:https://fuel.gitbook.io/documentation/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Connection Issue causing crashes

Turalllb opened this issue · comments

Caused by: com.github.kittinunf.fuel.core.FuelError: SSL handshake timed out
Caused by: com.github.kittinunf.fuel.core.FuelError: Unable to resolve host "url": No address associated with hostname I removed the actual url here
Caused by: com.github.kittinunf.fuel.core.FuelError: Read error: ssl=0x7d6dfb3488: I/O error during system call, Software caused connection abort

I have 10 percent of users suffering from such errors, they cannot be caught using try, since the exception is not thrown up. I am assuming that they occur with poor internet connection, but the problem cannot be reproduced.

#552 That's when a similar ticket was started. But a similar problem still exists.

#659 Here, a person has an example of the same problem, but I didn't see any solution.

fuel version 2.2.2

Fatal Exception: java.net.SocketTimeoutException
SSL handshake timed out
com.android.org.conscrypt.NativeCrypto.SSL_do_handshake (NativeCrypto.java)
com.android.okhttp.internal.huc.HttpsURLConnectionImpl.connect (HttpsURLConnectionImpl.java:26)
com.github.kittinunf.fuel.toolbox.HttpClient.f (SourceFile:27)
com.github.kittinunf.fuel.toolbox.HttpClient.b (SourceFile:2)
com.github.kittinunf.fuel.toolbox.HttpClient.awaitRequest (SourceFile:2)
com.github.kittinunf.fuel.core.requests.SuspendableRequest.a (SourceFile:4)
com.github.kittinunf.fuel.core.requests.SuspendableRequest.awaitResult (SourceFile:5)
com.github.kittinunf.fuel.core.DeserializableKt.awaitResponseResult (SourceFile:4)
ru.ctcmedia.moretv.common.services.networkservice.api.ApiClientImpl$response$$inlined$awaitStringResponseResult$1.invokeSuspend (SourceFile:1)
ru.ctcmedia.moretv.common.services.networkservice.api.ApiClientImpl$response$$inlined$awaitStringResponseResult$1.invoke (Источник неизвестен:10)
kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn (SourceFile:2)
kotlinx.coroutines.BuildersKt__Builders_commonKt.f (SourceFile:9)
kotlinx.coroutines.BuildersKt.withContext (SourceFile:1)
ru.ctcmedia.moretv.common.services.networkservice.api.ApiClientImpl.g (SourceFile:9)
ru.ctcmedia.moretv.common.services.networkservice.api.ApiClientImpl$runRequest$2$requestJob$1.invokeSuspend (SourceFile:4)
kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith (SourceFile:3)
kotlinx.coroutines.DispatchedTask.run (SourceFile:18)
kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely (SourceFile:1)
kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.c (SourceFile:4)
kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.i (SourceFile:4)
kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run (SourceFile:1)

Please tell me if you understand that if you have a crash in the Thread that you created, the crash will not reach the user code. https://docs.oracle.com/javase/7/docs/api/java/lang/Thread.UncaughtExceptionHandler.html

So it will not work to protect yourself with try catch if you have exceptions in the Thread that you threw. Most often it is socketTimeOut, 15 seconds is not enough to complete the request, probably with a bad Internet.

I understood what the problem is. Found in my code lauch {} in which the network call was made. The coroutine crashed and threw an exception.