Commit edda70f2d5 for bind
commit edda70f2d54171017756fc7acd3266ec69f3eced
Author: Michal Nowak <mnowak@isc.org>
Date: Tue Sep 15 09:35:10 2026 +0000
Detect named crashing on shutdown in pairwise testing
The pairwise testing script only checked that named survived for a
few seconds by looking for exit code 124 from "timeout", so a crash or
an assertion failure while shutting down after the SIGTERM sent by
"timeout" went unnoticed. Use --preserve-status so that named's own
exit code is reported instead: a clean shutdown yields 0, while a
crash at startup or during shutdown, or a shutdown which hangs until
"timeout" resorts to SIGKILL, all yield a non-zero exit code.
Assisted-by: Claude:claude-fable-5-1
diff --git a/util/pairwise-testing.sh b/util/pairwise-testing.sh
index 46747ca0c5..5aa15c7c6d 100755
--- a/util/pairwise-testing.sh
+++ b/util/pairwise-testing.sh
@@ -65,17 +65,18 @@ while read -r -a configure_switches; do
echo "Running..."
echo "${NAMED_CONF}" >named.conf
echo "${ZONE_CONTENTS}" >zone.db
+ # Let named run for a while, then ask it to shut down using SIGTERM
+ # (which is what "timeout" sends once the time is up) and check that
+ # it exited cleanly. Thanks to --preserve-status, a crash or an
+ # assertion failure at startup or during shutdown, as well as a
+ # shutdown which does not complete before "timeout" resorts to
+ # SIGKILL, all result in a non-zero exit code.
ret=0
- timeout --kill-after=5s 5s build/named -c named.conf -g >>"../pairwise-output.${runid}.txt" 2>&1 || ret=$?
- # "124" is the exit code "timeout" returns when it terminates
- # the command; in other words, the command-under-test times
- # out, i.e., was still running and didn't crash.
- if [ "${ret}" -ne 124 ]; then
- echo "Unexpected exit code from the 'timeout' utility (${ret})"
+ timeout --preserve-status --kill-after=5s 5s build/named -c named.conf -g >>"../pairwise-output.${runid}.txt" 2>&1 || ret=$?
+ if [ "${ret}" -ne 0 ]; then
+ echo "named exited with a non-zero exit code (${ret})"
exit 1
fi
- # "timeout" is unable to report a crash on shutdown via its exit
- # code.
cd ..
rm -rf "pairwise-${runid}"
done <pairwise-commands.txt