From: Otto Moerbeek Date: Wed, 14 Aug 2024 11:37:23 +0000 (+0200) Subject: rec: fix a race in the dnstap regression tests X-Git-Tag: rec-5.2.0-alpha1~125^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7a1c5761ac13325ceae4962c5f525618d49fae37;p=thirdparty%2Fpdns.git rec: fix a race in the dnstap regression tests A test might finish "too early". In that case not all workers are fully setup yet, and leak sanitizer crashes due to a stack out of bounds. One case fixed by introducing a sleep (for a test to see if the dnstap queue is empty), and one actually querying an existing out-of-band domain, which was enough for me to get all threads properly setup. Previously it would check a domain and get connnection refused, as this test does not setup auths at all. The assumption is that that causes a "too fast exit" of rec. --- diff --git a/regression-tests.recursor-dnssec/test_RecDnstap.py b/regression-tests.recursor-dnssec/test_RecDnstap.py index b975483d7d..d84d6bccc7 100644 --- a/regression-tests.recursor-dnssec/test_RecDnstap.py +++ b/regression-tests.recursor-dnssec/test_RecDnstap.py @@ -4,6 +4,7 @@ import socket import struct import sys import threading +import time import dns import dnstap_pb2 from unittest import SkipTest @@ -330,6 +331,7 @@ dnstapFrameStreamServer({"%s"}, {logQueries=false}) self.assertNotEqual(res, None) # We don't expect anything + time.sleep(1) self.assertTrue(DNSTapServerParameters.queue.empty()) class DNSTapLogNODTest(TestRecursorDNSTap): @@ -368,7 +370,7 @@ dnstapNODFrameStreamServer({"%s"}) return dnstap def testA(self): - name = 'www.example.org.' + name = 'types.example.' query = dns.message.make_query(name, 'A', want_dnssec=True) query.flags |= dns.flags.RD res = self.sendUDPQuery(query)