mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-30 14:07:59 +00:00
Fix waiting for lock file removal upon exit
Commitc787a539d2
fixed a certain class of intermittent system test failures caused by named instances unable to restart. The root cause was bin/tests/system/stop.pl returning without waiting for a named instance to remove its lock file. Later on, it turned out that the above change causes other issues on Windows due to the way named handles signals on that platform. Commit761ba4514f
intended to address those issues by making the server_lock_file() subroutine in bin/tests/system/stop.pl return an empty value on Windows, in order to prevent the script for waiting for lock file cleanup on that platform. Note, however, that Windows detection in that subroutine is limited to checking whether the CYGWIN environment variable is set. While that environment variable was not set on Unix-like systems before commit761ba4514f
, another commit (a33237f070
, merged a few weeks later) changed that by setting the CYGWIN environment variable to an empty value on Unix-like systems. This made the defined($ENV{'CYGWIN'}) check in server_lock_file() return true, inadvertently preventing bin/tests/system/stop.pl from waiting for lock file removal before exiting on Unix-like systems and therefore reintroducing the original issue. Fix by making server_lock_file() only return an empty value when the CYGWIN environment variable is set to a non-empty value (which is what bin/tests/system/conf.sh.win32 does). Adjust a similar check in the pid_file_exists() subroutine in the same way for consistency.
This commit is contained in:
@@ -134,7 +134,7 @@ exit($errors);
|
||||
sub server_lock_file {
|
||||
my ( $server ) = @_;
|
||||
|
||||
return if (defined($ENV{'CYGWIN'}));
|
||||
return if (defined($ENV{'CYGWIN'}) && $ENV{'CYGWIN'});
|
||||
|
||||
return $testdir . "/" . $server . "/named.lock" if ($server =~ /^ns/);
|
||||
return if ($server =~ /^ans/);
|
||||
@@ -255,7 +255,7 @@ sub pid_file_exists {
|
||||
if (send_signal(0, $pid) == 0) {
|
||||
# XXX: on windows this is likely to result in a
|
||||
# false positive, so don't bother reporting the error.
|
||||
if (!defined($ENV{'CYGWIN'})) {
|
||||
if (!defined($ENV{'CYGWIN'}) || !$ENV{'CYGWIN'}) {
|
||||
print "I:$test:$server crashed on shutdown\n";
|
||||
$errors = 1;
|
||||
}
|
||||
|
Reference in New Issue
Block a user