From d6b8c7da4baadc78bb4089ed27360de51092f5b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20K=C4=99pie=C5=84?= Date: Fri, 19 Apr 2019 09:37:51 +0200 Subject: [PATCH 1/2] win32: fix service state reported during shutdown When a Windows service receives a request to stop, it should not set its state to SERVICE_STOPPED until it is completely shut down as doing that allows the operating system to kill that service prematurely, which in the case of named may e.g. prevent the PID file and/or the lock file from being cleaned up. Set service state to SERVICE_STOP_PENDING when named begins its shutdown and only report the SERVICE_STOPPED state immediately before exiting. (cherry picked from commit 964749dfdbb51b4f1626edf1eb97df33600c10ae) --- bin/named/win32/ntservice.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/named/win32/ntservice.c b/bin/named/win32/ntservice.c index 23a5dc4b40..fe4ab5c44d 100644 --- a/bin/named/win32/ntservice.c +++ b/bin/named/win32/ntservice.c @@ -82,7 +82,7 @@ ServiceControl(DWORD dwCtrlCode) { case SERVICE_CONTROL_STOP: ns_server_flushonshutdown(ns_g_server, true); isc_app_shutdown(); - UpdateSCM(SERVICE_STOPPED); + UpdateSCM(SERVICE_STOP_PENDING); break; default: break; From 89c8fed44947deddfbbb08e1e96dbd96e4d439e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20K=C4=99pie=C5=84?= Date: Fri, 19 Apr 2019 09:37:51 +0200 Subject: [PATCH 2/2] Add CHANGES entry 5213. [bug] win32: Eliminated a race which allowed named.exe running as a service to be killed prematurely during shutdown. [GL #978] (cherry picked from commit e7332343ed8581607efbec2c0159e7f0eaa4a539) --- CHANGES | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGES b/CHANGES index ae83d90b91..cf4f4e4d19 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,7 @@ +5213. [bug] win32: Eliminated a race which allowed named.exe running + as a service to be killed prematurely during shutdown. + [GL #978] + 5210. [bug] When dnstap is enabled and recursion is not available, incoming queries are now logged as "auth". Previously, this depended on whether