]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Fix a flaky Proxy Protocol regression test 15631/head
authorRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 5 Jun 2025 11:06:22 +0000 (13:06 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 5 Jun 2025 11:08:08 +0000 (13:08 +0200)
Signed-off-by: Remi Gacogne <remi.gacogne@powerdns.com>
regression-tests.dnsdist/test_ProxyProtocol.py

index 5619ae037b7a7771c56160195003eb208821986f..b597469816f10ec440095383543517f354a19781 100644 (file)
@@ -456,9 +456,15 @@ class TestProxyProtocol(ProxyProtocolTest):
       # in some cases existing (established before this test) connections to the backend might still
       # exist, so we cannot enforce a strict "only 1 connection" check
       self.assertLessEqual(server['tcpMaxConcurrentConnections'], max_conns_before + 1)
-      # but if we managed to add more than one connection to the existing ones, something is
+      # but if we managed to add more than two connections to the existing ones, something is
       # wrong!
-      self.assertLessEqual(server['tcpMaxConcurrentConnections'], current_conns_before + 1)
+      # why two and not one? when a query arrives we retrieve the "owned" outgoing connection to the backend,
+      # and we notice that the TLVs are different than the previous ones, so we discard the outgoing connection
+      # and create a new one. This should lead to only one concurrent connection, except that if we read the
+      # new query while being called from the function handling the response from the backend, we might still
+      # hold a shared reference to the previous connection. It will be released when we come back to the calling
+      # function, but for a short time we will have two concurrent connections.
+      self.assertLessEqual(server['tcpMaxConcurrentConnections'], current_conns_before + 2)
 
 class TestProxyProtocolIncoming(ProxyProtocolTest):
     """