From df87df3a0df12ffec12186c30285a5cbeb950b4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Fri, 21 Aug 2020 09:20:58 +0300 Subject: [PATCH] Reduce slow DCB shutdown timeout to 2 seconds This helps reduce the effect that a hanging connection has on the whole system. Making this configurable shouldn't be needed as long as the rate of authentication failures doesn't exceed an acceptable level. In most practical cases allowing two seconds for authentication to complete should be enough. --- server/core/routingworker.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/core/routingworker.cc b/server/core/routingworker.cc index 6b578ac75..bb9fcc2a4 100644 --- a/server/core/routingworker.cc +++ b/server/core/routingworker.cc @@ -165,9 +165,10 @@ void modules_thread_finish() bool can_close_dcb(DCB* dcb) { + const int SHOW_SHUTDOWN_TIMEOUT = 2; auto idle = MXS_CLOCK_TO_SEC(mxs_clock() - dcb->last_read); - return idle > 5 // Timed out + return idle > SHOW_SHUTDOWN_TIMEOUT // Timed out || !dcb->func.can_close // Not implemented || dcb->func.can_close(dcb); // Protocol says it's OK to close }