https://kotlinlang.org logo
Title
v

Vinicius Carvalho

03/13/2019, 8:07 PM
for(i in 0..invocations){
            launch {
                val response = client.call(host).response
                val result = mapper.readValue<FunctionResponse>(response.readBytes())
                val requestTime = response.responseTime.timestamp - response.requestTime.timestamp
                channel.send(ExecutionEvent(requestTime = requestTime, pause = result.pause))
            }
        }
e

e5l

03/14/2019, 6:41 AM
Hi @Vinicius Carvalho, could you try to close the response after using it?
v

Vinicius Carvalho

03/14/2019, 12:46 PM
Hi @e5l I had a version of the snipped that I was doing that on the line before
channel.send
did not help
Another thing to note, the client then rejects any new requests
that for loop sits on a function that can be called repeatedly, and after the first invocation, subsequent invocations would not complete
Here's a gist with the service that I run
I call start(N) several times (doing some load testing on an endpoint). Later I get a report from the
tasks
list.
It works fine with
Apache
but with
CIO
the described behavior kicks in and it hangs after a few requests
Using ktor 1.1.3 BTW