]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
modules/watchdog: use abort() for restarts
authorVladimír Čunát <vladimir.cunat@nic.cz>
Thu, 10 Oct 2019 13:16:03 +0000 (15:16 +0200)
committerVladimír Čunát <vcunat@gmail.com>
Wed, 23 Oct 2019 11:48:53 +0000 (13:48 +0200)
Motivation: core-dump might be very useful, and in this case there
are even very useful pointers on the C stack.

modules/watchdog/README.rst
modules/watchdog/watchdog.lua
systemd/kresd@.service.in

index 04341e59c2cd7f1fcd523582eba05bfa3f09ac02..cd2fbd03801476b564e1b754d0ffc6680ac06947 100644 (file)
@@ -17,8 +17,8 @@ answers correctly. To use this feature you must configure DNS name and type to q
 
 Each single query from watchdog must result in answer with
 RCODE = NOERROR or NXDOMAIN. Any other result will terminate the resolver
-(with exit code 69) to allow the supervisor process to do cleanup and restart
-the resolver.
+(with SIGABRT) to allow the supervisor process to do cleanup, gather coredump
+and restart the resolver.
 
 It is recommended to use a name with a very short TTL to make sure the watchdog
 is testing all parts of resolver and not only its cache. Obviously this check
index 2251a4141af5a30d5d7a5db2aa45fb5a65f698d8..7a7f5aa5446c7b16899b50d4a8c8d983d43f2456 100644 (file)
@@ -3,6 +3,7 @@ local ffi = require('ffi')
 ffi.cdef([[
        int sd_watchdog_enabled(int unset_environment, uint64_t *usec);
        int sd_notify(int unset_environment, const char *state);
+       void abort(void);
 ]])
 
 local watchdog = {}
@@ -13,8 +14,8 @@ local function sd_signal_ok()
 end
 
 function private.fail_callback()
-       log('[watchdog] TERMINATING resolver, supervisor is expected to restart it')
-       os.exit(69)  -- unclean exit code = EX_UNAVAILABLE
+       log('[watchdog] ABORTING resolver, supervisor is expected to restart it')
+       ffi.C.abort()
 end
 
 -- logging
index 3e30a33eda5860c66f7c141dc9b965479a3eb285..6454cc2d1eeb8abd1d90fd79474b5eb96461b6ff 100644 (file)
@@ -14,7 +14,6 @@ ExecStart=@sbin_dir@/kresd --config=@etc_dir@/kresd.conf
 User=@user@
 TimeoutStopSec=10s
 WatchdogSec=10s
-RestartForceExitStatus=69
 Restart=on-abnormal
 LimitNOFILE=1048576
 Sockets=kresd.socket