You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the client close the connection ungracefully - for example send RST without sending ACK/FIN, RouteDirectives can't complete a slow response until hitting the server request timeout, is this by design or bug?
Set Server request timeout to 5 seconds
val slowResponseTime = 3.seconds
path("abc") {
val timeoutResponse = {
HttpResponse(
StatusCodes.EnhanceYourCalm,
entity = formatCurrentMilliseconds() + ": Unable to serve response within time limit")
}
withRequestTimeoutResponse(request => {
System.out.println(formatCurrentMilliseconds() + ": Unable to serve response within time limit = " + count.get())
timeoutResponse
}) {
val slowFuture = {
val futureResponse: Future[HttpResponse] = Future {
Thread.sleep(slowResponseTime.toMillis)
System.out.println(formatCurrentMilliseconds() + ": response to abc is created")
HttpResponse(entity = HttpEntity(ContentTypes.`text/html(UTF-8)`, "response to abc,it is slow"))
}
futureResponse
}
val response = slowFuture // very slow
complete(response)
}
}
we can see debug log like, I would expect complete should be invoked if there is an error in the flow, Unable to serve response within time limit should not be displayed in this case or it should not wait until server request timeout
[DEBUG] [12/23/2024 10:11:24.485] [akka-http-server-system-akka.actor.internal-dispatcher-6] [akka://akka-http-server-system/system/IO-TCP/selectors/$a/0] New connection accepted
20241223 10:11:24:623: Get Request = 0
[DEBUG] [12/23/2024 10:11:26.488] [akka-http-server-system-akka.actor.internal-dispatcher-6] [akka://akka-http-server-system/system/IO-TCP/selectors/$a/1] Closing connection due to IO error java.io.IOException: An existing connection was forcibly closed by the remote host
20241223 10:11:27:635: response to abc is created
20241223 10:11:29:636: Unable to serve response within time limit
When the client close the connection ungracefully - for example send RST without sending ACK/FIN, RouteDirectives can't complete a slow response until hitting the server request timeout, is this by design or bug?
Set Server request timeout to 5 seconds
we can see debug log like, I would expect complete should be invoked if there is an error in the flow, Unable to serve response within time limit should not be displayed in this case or it should not wait until server request timeout
Python script to simulate ungraceful shutdown
The text was updated successfully, but these errors were encountered: