Commit Graph

30528 Commits

Author SHA1 Message Date
Mark Andrews
4dd9ec8919 Increase wait_for_message attempts to 20. 2019-12-06 13:40:46 +00:00
Mark Andrews
1334daaec0 save wait_for_message contents 2019-12-06 13:40:46 +00:00
Michał Kępień
dd6f9391c3 Merge branch '1452-system-test-framework-cleanup-tweaks' into 'master'
System test framework: cleanup tweaks

Closes #1452

See merge request isc-projects/bind9!2717
2019-12-06 13:32:07 +00:00
Michał Kępień
34fb70b17c Merge branch '1452-detect-missing-system-test-results' into 'master'
Detect missing system test results

See merge request isc-projects/bind9!2708
2019-12-06 13:24:26 +00:00
Michał Kępień
d8905b7a9c Automatically run clean.sh from run.sh
The first step in all existing setup.sh scripts is to call clean.sh.  To
reduce code duplication and ensure all system tests added in the future
behave consistently with existing ones, invoke clean.sh from run.sh
before calling setup.sh.
2019-12-06 14:11:01 +01:00
Michał Kępień
3c3085be3c Detect missing system test results
At the end of each system test suite run, the system test framework
collects all existing test.output files from system test subdirectories
and produces bin/tests/system/systests.output from those files.
However, it does not check whether a test.output file was found for
every executed test.  Thus, if the test.output file is accidentally
deleted by the system test itself (e.g. due to an overly broad file
removal wildcard present in clean.sh), its output will not be included
in bin/tests/system/systests.output.  Since the result of each system
test suite run is determined by bin/tests/system/testsummary.sh, which
only operates on the contents of bin/tests/system/systests.output, this
can lead to test failures being ignored.  Fix by ensuring the number of
test results found in bin/tests/system/systests.output is equal to the
number of tests run and triggering a system test suite failure in case
of a discrepancy between these two values.
2019-12-06 14:11:01 +01:00
Michał Kępień
bf3eeac067 Remove bin/tests/system/clean.sh
Since the role of the bin/tests/system/clean.sh script has now been
reduced to calling a given system test's clean.sh script, remove the
former altogether and replace its only use with a direct invocation of
the latter.
2019-12-06 14:11:01 +01:00
Michał Kępień
b4d37878f6 Remove the -r switch from system test scripts
Since files containing system test output are no longer stored in test
subdirectories, bin/tests/system/clean.sh no longer needs to take care
of removing the test.output file for a given test as testsummary.sh
already takes care of that and even if a test suite terminates
abnormally and another one is started, tee invoked without the -a
command line switch overwrites the destination file if it exists, so
leftover test.output.* files from previous test suite runs are not a
concern.  Remove the -r command line switch and the code associated with
it from the relevant scripts.
2019-12-06 14:11:01 +01:00
Michał Kępień
b0916bba41 Store system test output in bin/tests/system/
Some clean.sh scripts contain overly broad file deletion wildcards which
cause the test.output file (used by the system test framework for
collecting output) in a given system test's directory to be erroneously
removed immediately after the test is started (due to setup.sh scripts
calling clean.sh at the beginning).  This prevents the test's output
from being placed in bin/tests/system/systests.output at the end of a
test suite run and thus can lead to test failures being ignored.  Fix by
storing each test's output in a test.output.<test-name> file in
bin/tests/system/, which prevents clean.sh scripts from removing it (as
they should only ever affect files contained in a given system test's
directory).
2019-12-06 14:11:01 +01:00
Matthijs Mekking
26ee43da1b Merge branch '1460-duration-ttlval-print-bug' into 'master'
Resolve "checkconf test failure on Solaris"

Closes #1460

See merge request isc-projects/bind9!2718
2019-12-06 13:03:14 +00:00
Ondřej Surý
9dfa33050b Add semantic patch to find void f() { ... return ((void)g())); ... }
When a function returns void, it can be used as an argument to return in
function returning also void, e.g.:

void in(void) {
  return;
}

void out(void) {
  return (in());
}

while this is legal, it should be rewritten as:

void out(void) {
  in();
  return;
}

The semantic patch just find the occurrences, and they need to be fixed
by hand.
2019-12-06 13:42:18 +01:00
Matthijs Mekking
60fa5fc760 Fix duration printing on Solaris 2019-12-06 13:12:06 +01:00
Matthijs Mekking
8fd8404e16 Replace two leftover ttlval with duration
Since the introduction of durations, all ttlval configuration types
are replaced with durations.  Duration is an ISO 8601 duration, a
TTL-style value, or a number.  These two references were missed and
are now also replaced.
2019-12-06 12:28:40 +01:00
Matthijs Mekking
4597ebc91b Merge branch 'trust-anchors-minor-fixes' into 'master'
Minor fixes in trust anchor code

See merge request isc-projects/bind9!2676
2019-12-06 08:12:55 +00:00
Matthijs Mekking
eddac8575d Minor fixes in trust anchor code
This commit makes some minor changes to the trust anchor code:

1. Replace the undescriptive n1, n2 and n3 identifiers with slightly
   better rdata1, rdata2, and rdata3.
2. Fix an occurrence where in the error log message a static number
   32 was printed, rather than the rdata3 length.
3. Add a default case to the switch statement checking DS digest
   algorithms to catch unknown algorithms.
2019-12-06 07:12:24 +00:00
Mark Andrews
564707023c Merge branch '1455-job-failed-453300' into 'master'
Resolve "Job Failed #453300"

Closes #1455

See merge request isc-projects/bind9!2706
2019-12-05 22:05:24 +00:00
Mark Andrews
e4b1d0b686 loop waiting for the redirect zone to load 2019-12-05 21:31:32 +00:00
Ondřej Surý
3fb215c952 Merge branch '1427-intermittent-failure-in-fetchlimit-system-test' into 'master'
Test for the hard fetchlimit instead of soft fetchlimit

Closes #1427

See merge request isc-projects/bind9!2705
2019-12-05 15:55:24 +00:00
Ondřej Surý
c35a4e05fa Test for the hard fetchlimit instead of soft fetchlimit
Previously, the fetchlimit tested the recursive-clients soft limit
that's defined as 90% of the hard limit (the actual configured value).
This worked previously because the reaping of the oldest recursive
client was put on the same event queue as the current TCP client, thus
the cleaning has happened before the new TCP client established a new
connection.

With the change in BIND 9.14 that added a multiple event queues the
cleaning of the oldests clients is no longer synchronous and could
happen stochastically making the soft limit testing fail often.  The
situation became even worse with the new networking manager, thus we
change the system test to fail only if the hard limit bound is not
honored.

Changing the accounting of the already reaped TCP clients so the soft
limit testing is possible again is out of the scope for this change.
2019-12-05 16:33:12 +01:00
Ondřej Surý
a07f9b71e9 Merge branch '1407-intermittent-failure-in-the-mkeys-system-test' into 'master'
Improve the error handling in mkeys test and use retry_quiet()

Closes #1407

See merge request isc-projects/bind9!2704
2019-12-05 14:24:29 +00:00
Ondřej Surý
b0ad689e16 Wait for 'all zones loaded' message instead of zoneless 'loaded serial' message 2019-12-05 15:22:28 +01:00
Ondřej Surý
3b63c51a64 Save all rndc diagnostic output 2019-12-05 15:22:28 +01:00
Ondřej Surý
4ff25c06c1 Make mkeys system test shellcheck clean and run under set -e 2019-12-05 15:22:28 +01:00
Ondřej Surý
f239d67c1a Improve the error handling in mkeys test and use retry_quiet() 2019-12-05 15:22:28 +01:00
Matthijs Mekking
ec80d61ab0 Merge branch 'dnssec-keys-rename-to-trust-anchors' into 'master'
Rename 'dnssec-keys' to 'trust-anchors'

See merge request isc-projects/bind9!2702
2019-12-05 13:57:11 +00:00
Matthijs Mekking
8c37d3d320 Rename 'dnssec-keys' to 'trust-anchors' 2019-12-05 12:19:17 +01:00
Diego dos Santos Fronza
e2129fb103 Merge branch '1410-intermittent-failure-in-the-resolver-test' into 'master'
Resolve "Intermittent failure in the resolver test"

Closes #1410

See merge request isc-projects/bind9!2671
2019-12-04 22:58:21 +00:00
Diego Fronza
994fc2e822 Improved prefetch disabled test code
Using retry_quiet to test that prefetch is disabled instead of a
standard loop with sleep 1 between each iteration.
2019-12-04 19:29:55 -03:00
Diego Fronza
a711d6f8c0 Fix resolver tests: prefetch 40/41
These two tests were failing basically because in order for prefetching to
happen, the TTL for a given DNS record must be greater than or equal to
the prefetch config value + 9.

The previous TTL for both records was 10, while prefetch value in
configuration was 3, thus making only records with TTL >= 12 elligible
for prefetching.

TTL value for both records was adjusted to the value 13, and prefetch
value was set to 4 (inc by 1), so records with TTL (4 + 9) >= 13 are
elligible for prefetching.

Adjusting prefetch value to 4 gives the test 1 second more to avoid time
problems when sharing resources on a heavy loaded PC.

Also prefetch value in settings is now read by the script and used
by it to corrrectly calculate the amount of time needed to delay before
sending a request to trigger prefetch, adding a bit of flexibility to
fine tune the test in the future.
2019-12-04 19:29:55 -03:00
Diego Fronza
dd524cc893 Fix resolver test: prefetch disabled
The previous test had two problems:
1. It wasn't written specifically for testing what it was supposed to:
prefetch disabled.
2. It could fail in some circunstances if the computer's load is too
high, due to sleeps not taking parallel tests and cpu load into account.

The new test is testing prefetch disabled as follows:
1. It asks for a txt record for a given domain and takes note of the
record's TTL (which is 10).
2. It sleeps for (TTL - 5) = 5 seconds, having a window of 5 seconds to
issue new queries before the record expires from cache.
3. Three(3) queries are executed in a row, with a interval of 1 second
between them, and for each query we verify that the TTL in response is
less than the previous one, thus ensuring that prefetch is disabled (if
it were enabled this record would have been refreshed already and TTL
would be >= the first TTL).

Having a window of 5 seconds to perform 3 queries with a interval of 1
second between them gives the test a reasonable amount of time
to not suffer from a machine with heavy load.
2019-12-04 19:29:54 -03:00
Ondřej Surý
da94ed13b8 Merge branch '1444-deprecate-isc_thread_key-API' into 'master'
Use native compiler Thread Local Storage instead of isc_thread_key API

Closes #1444

See merge request isc-projects/bind9!2680
2019-12-04 22:07:54 +00:00
Ondřej Surý
04e901a86c Add CHANGES 2019-12-04 22:25:57 +01:00
Ondřej Surý
c62748c9e3 Update PLATFORMS.md to explicitly list Thread Local Storage as requirement for BIND 9 2019-12-04 14:17:19 +01:00
Ondřej Surý
b1a7ec7481 Remove isc_thread_key API in favor of ISC_THREAD_LOCAL variables
For BIND 9.16+, TLS aware compiler is required, and using
ISC_THREAD_LOCAL is preferred way of using Thread Local Storage.  The
isc_thread_key API is no longer used anywhere and hence was removed from
BIND 9.
2019-12-04 14:17:19 +01:00
Ondřej Surý
5d43b7126c Refactor the irs_context API to use ISC_THREAD_LOCAL
Previously, the irs_context API used isc_thread_key API for TLS, which is
fairly complicated and requires initialization of memory contexts, etc.
This part of code was refactored to use a ISC_THREAD_LOCAL pointer which
greatly simplifies the whole code related to storing TLS variables.
2019-12-04 14:17:19 +01:00
Ondřej Surý
a4ffb64073 Refactor the dns_geoip API to use ISC_THREAD_LOCAL
Previously, the dns_geoip API used isc_thread_key API for TLS, which is
fairly complicated and requires initialization of memory contexts, etc.
This part of code was refactored to use a ISC_THREAD_LOCAL pointer which
greatly simplifies the whole code related to storing TLS variables, and
creating the local memory context was moved to named and stored in the
named_g_geoip global context.
2019-12-04 14:17:19 +01:00
Ondřej Surý
4a3d589403 Refactor the dns_dt API to use ISC_THREAD_LOCAL
Previously, the dns_dt API used isc_thread_key API for TLS, which is
fairly complicated and requires initialization of memory contexts, etc.
This part of code was refactored to use a ISC_THREAD_LOCAL pointer which
greatly simplifies the whole code related to storing TLS variables.
2019-12-03 16:27:30 +01:00
Ondřej Surý
1a66aabd22 Refactor the dns_name API to use ISC_THREAD_LOCAL
Previously, the dns_name API used isc_thread_key API for TLS, which is
fairly complicated and requires initialization of memory contexts, etc.
This part of code was refactored to use a ISC_THREAD_LOCAL pointer which
greatly simplifies the whole code related to storing TLS variables.
2019-12-03 16:27:24 +01:00
Ondřej Surý
01731d4b1b Add and use ISC_THREAD_LOCAL macro
The new ISC_THREAD_LOCAL macro unifies usage of platform dependent
Thread Local Storage definition thread_local vs __thread vs
__declspec(thread) to a single macro.

The commit also unifies the required level of support for TLS as for
some parts of the code it was mandatory and for some parts of the code
it wasn't.
2019-12-03 16:27:24 +01:00
Mark Andrews
96475e7eb4 Merge branch '1434-explicitly-set-python-to-a-empty-string-with-without-python' into 'master'
Resolve "explicitly set PYTHON to a empty string with --without-python"

Closes #1434

See merge request isc-projects/bind9!2672
2019-12-03 12:48:42 +00:00
Mark Andrews
eed2aabc40 add AC_ARG_VAR([PYTHON], [path to python executable]) 2019-12-03 23:42:08 +11:00
Mark Andrews
8cd3cf90b2 add CHANGES 2019-12-03 23:42:08 +11:00
Mark Andrews
d8fc544569 unset PYTHON on --without-python to prevent python still being used 2019-12-03 23:41:28 +11:00
Mark Andrews
e4fcbba86e Merge branch '1419-threadsanitizer-data-race-rbtdb-c-7568-in-issecure' into 'master'
Resolve "ThreadSanitizer: data race rbtdb.c:7568 in issecure"

Closes #1419

See merge request isc-projects/bind9!2656
2019-12-03 01:14:27 +00:00
Mark Andrews
cd2469d3cd r/w of rbtdb->current_version requires that rbtdb->lock be held 2019-12-02 23:48:41 +00:00
Mark Andrews
e121c3e179 Merge branch '1412-threadsanitizer-data-race-resolver-c-7030-in-fctx_decreference-2' into 'master'
Resolve "ThreadSanitizer: data race resolver.c:7030 in fctx_decreference"

Closes #1412

See merge request isc-projects/bind9!2673
2019-12-02 23:46:16 +00:00
Mark Andrews
912ce87479 Make fctx->attributes atomic.
FCTX_ATTR_SHUTTINGDOWN needs to be set and tested while holding the node
lock but the rest of the attributes don't as they are task locked. Making
fctx->attributes atomic allows both behaviours without races.
2019-12-03 08:58:53 +11:00
Michał Kępień
29c83f5922 Merge branch 'michal/address-asan-memory-leak-reports' into 'master'
Address ASAN memory leak reports

See merge request isc-projects/bind9!2679
2019-12-02 15:07:45 +00:00
Michał Kępień
6ee04f8458 Do not define ASAN_OPTIONS at build time
Disabling ASAN memory leak detection for a build job is pointless
because ASAN is only used in test jobs.  (Also, memory leak detection
should not be disabled globally - explicit suppressions should be used
in case of issues with external code.)
2019-12-02 16:03:23 +01:00
Michał Kępień
b425b5d56e Move xmlInitThreads()/xmlCleanupThreads() calls
xmlInitThreads() and xmlCleanupThreads() are called from within
named_statschannels_configure() and named_statschannels_shutdown(),
respectively.  Both of these functions are executed by worker threads,
not the main named thread.  This causes ASAN to report memory leaks like
the following one upon shutdown (as long as named is asked to produce
any XML output over its configured statistics channels during its
lifetime):

    Direct leak of 968 byte(s) in 1 object(s) allocated from:
        #0 0x7f677c249cd8 in __interceptor_calloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cc:153
        #1 0x7f677bc1838f in xmlGetGlobalState (/usr/lib/libxml2.so.2+0xa838f)

The data mentioned in the above report is a libxml2 state structure
stored as thread-specific data.  Such chunks of memory are automatically
released (by a destructor passed to pthread_key_create() by libxml2)
whenever a thread that allocated a given chunk exits.  However, if
xmlCleanupThreads() is called by a given thread before it exits, the
destructor will not be invoked (due to xmlCleanupThreads() calling
pthread_key_delete()) and ASAN will report a memory leak.  Thus,
xmlInitThreads() and xmlCleanupThreads() must not be called from worker
threads.  Since xmlInitThreads() must be called on Windows in order for
libxml2 to work at all, move xmlInitThreads() and xmlCleanupThreads()
calls to the main named thread (which does not produce any XML output
itself) in order to prevent the memory leak from being reported by ASAN.
2019-12-02 16:03:23 +01:00