How does ktor with Native embeddedServer CIO engin...
# ktor
j
How does ktor with Native embeddedServer CIO engine handle connections with zero length data? Does it automatically disconnect? I am having a somewhat odd memory allocation experience on a vm instance with limited resources, where these connections never seem to be freed.
https://api.ktor.io/ktor-server/ktor-server-cio/io.ktor.server.cio/-c-i-o-application-engine/-configuration/index.html seems to say 45 seconds, but I'm seeing something odd, I'm not sure the memory footprint for these connections is ever freed properly
This is without basically any real requests, just empty connections
Dependencies for linux: ktor-server-core - 2.1.2 (also tested with 2.1.3-eap-521) ktor-server-cio - 2.1.2 (also tested with 2.1.3-eap-521) kotlinx-coroutines-core - 1.6.4 all of this is running in a docker container with a load balancer in front
Compared to if I roll a test http server built with zeromq that has the socket handler which just disconnects zero length data and give back a real http response if the data contains a proper http request (Comparing coroutines io vs classic blocking is not fair, but my hope is that it proves a point)
Copy code
data class Simple(val name:String, val nr:Int, val lnr2:Long, val status:Boolean)

fun main() {
    println("Trying to start server")

    val simple = Simple("Ape", 0, 1L, true)

    embeddedServer(CIO, port = 7878) {
        install(ContentNegotiation) {
            json(Json {
                prettyPrint = true
                isLenient = true
            })
        }
        routing {
            get("/status") {
                call.respond(HttpStatusCode.OK, simple)
            }
        }
    }.start(wait = true)
}
Is the code