Hi! We are using `compile "io.ktor:ktor-client-apa...
# ktor
g
Hi! We are using
compile "io.ktor:ktor-client-apache:1.2.3"
in a full fledged ktor project we have. We've been quite happy with it but lately it seems some services detoriate over time and we start to see
IO: Connection reset by peer
. Now my first approach was to check the server that is receiving the calls we are making (if they were being ddosed by us, potential downtime etc) but it seems that the http call doesn't even leave us. Given the detoriation over time my mind goes towards stale connection or something of that sort. Has anybody else experienced this kind of issue?
r
We are investigating a similar issue. Despite defining socket timeouts, all our coroutines get stuck here:
Copy code
Coroutine DeferredCoroutine{Active}@7ea38da2, state: SUSPENDED
        at kotlinx.coroutines.CompletableDeferredImpl.await(CompletableDeferred.kt:87)
        at io.ktor.client.engine.apache.ApacheHttpRequestKt.sendRequest(ApacheHttpRequest.kt:35)
        at io.ktor.client.engine.apache.ApacheEngine.execute(ApacheEngine.kt:37)
        at io.ktor.client.engine.HttpClientEngine$executeWithinCallContext$2.invokeSuspend(HttpClientEngine.kt:86)
Our version is ktor client 1.4.0
I will create an issue for this with the ktor project, please try https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-debug/kotlinx.coroutines.debug/-debug-probes/ and get a coroutine dump. We also see requests stop leaving our hosts at some point and all coroutines are in state SUSPENDED
We will open an issue tomorrow with coroutine dumps. Like I said above, this is despite setting socket, connect and connection lease timeouts that we have coroutines stuck indefinitely in SUSPENDED state
All of them look like this:
Copy code
Coroutine DeferredCoroutine{Active}@7ea38da2, state: SUSPENDED
        at kotlinx.coroutines.CompletableDeferredImpl.await(CompletableDeferred.kt:87)
        at io.ktor.client.engine.apache.ApacheHttpRequestKt.sendRequest(ApacheHttpRequest.kt:35)
        at io.ktor.client.engine.apache.ApacheEngine.execute(ApacheEngine.kt:37)
        at io.ktor.client.engine.HttpClientEngine$executeWithinCallContext$2.invokeSuspend(HttpClientEngine.kt:86)
        (Coroutine creation stacktrace)
        at kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsJvmKt.createCoroutineUnintercepted(IntrinsicsJvm.kt:122)
        at kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable(Cancellable.kt:26)
        at kotlinx.coroutines.BuildersKt.async$default(Unknown Source)
        at io.ktor.client.engine.HttpClientEngine$DefaultImpls.executeWithinCallContext(HttpClientEngine.kt:81)
        at io.ktor.client.engine.HttpClientEngine$install$1.invokeSuspend(HttpClientEngine.kt:66)
        at io.ktor.client.engine.HttpClientEngine$install$1.invoke(HttpClientEngine.kt)
        at io.ktor.util.pipeline.SuspendFunctionGun.loop(PipelineContext.kt:323)
        at io.ktor.util.pipeline.SuspendFunctionGun.proceed(PipelineContext.kt:168)
        at io.ktor.util.pipeline.SuspendFunctionGun.execute(PipelineContext.kt:188)
        at io.ktor.util.pipeline.Pipeline.execute(Pipeline.kt:31)
        at io.ktor.client.features.HttpSend$DefaultSender.execute(HttpSend.kt:124)
g
thanks! Let me know when you've created an issue and I can provide some data from our end as well
r
we have created an issue. We marked it private unfortunately since it contains some sensitive flight recording dumps…
please create a new issue and then jetbrains can merge information
you can refer to KTOR-950
g
gotcha, thanks!