]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Fix the number of concurrent queries on a backend TCP conn 11718/head
authorRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 23 Jun 2022 10:36:17 +0000 (12:36 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 23 Jun 2022 10:38:41 +0000 (12:38 +0200)
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

index c726775938e5fe6840c36de16ad254e1e369b34e..c257e0c1245d837d6356ab6797c3ae589db06d63 100644 (file)
@@ -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;
     }