https://kotlinlang.org logo
#ktor
Title
# ktor
m

Matt

03/08/2019, 2:10 PM
We're finding that slow HTTP POSTs into Ktor can block the server from responding to other connections until that request completes. Is that expected?
r

Robert Jaros

03/08/2019, 3:40 PM
You should not block the thread in the request processing code.
Use
withContext(<http://Dispatchers.IO|Dispatchers.IO>)
if your code is blocking.
m

Matt

03/08/2019, 3:50 PM
It blocks in Ktor code, e.g.:
Copy code
post("/login") {
            val credentials = call.receive<Credentials>()
            call.respond(credentials)
        }
r

Robert Jaros

03/08/2019, 5:27 PM
Any idea why this POST request is slow?
m

Matt

03/11/2019, 9:24 AM
We encounter it in our live web app, we haven't figured out exactly why it happens there, but we've can reproduce with slow POSTs manually with
telnet
r

Robert Jaros

03/11/2019, 10:08 AM
From what I understand it looks like a bug. Try filling an issue with ktor.
m

Matt

03/11/2019, 10:17 AM
4 Views