From 2848406e55b5a1d2e35bfa9f7c4dbb0c49989a1b Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Thu, 23 Jun 2022 12:36:17 +0200 Subject: [PATCH] dnsdist: Fix the number of concurrent queries on a backend TCP conn When we are in the process of sending a query to the backend, that query is no longer accounted in the "queued" queries nor it is in the "queued" responses, but we need to take it into account. Otherwise we might be sending two concurrent queries to a backend that does not support out-of-order processing (increasing our latency), or even worse to one that does not support pipelining. --- pdns/dnsdistdist/dnsdist-tcp-downstream.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pdns/dnsdistdist/dnsdist-tcp-downstream.hh b/pdns/dnsdistdist/dnsdist-tcp-downstream.hh index c726775938..c257e0c124 100644 --- a/pdns/dnsdistdist/dnsdist-tcp-downstream.hh +++ b/pdns/dnsdistdist/dnsdist-tcp-downstream.hh @@ -239,7 +239,7 @@ public: bool reachedMaxConcurrentQueries() const override { - const size_t concurrent = d_pendingQueries.size() + d_pendingResponses.size(); + const size_t concurrent = d_pendingQueries.size() + d_pendingResponses.size() + (d_state == State::sendingQueryToBackend ? 1 : 0); if (concurrent > 0 && concurrent >= d_ds->d_config.d_maxInFlightQueriesPerConn) { return true; } -- 2.47.2