[31603] in CVS-changelog-for-Kerberos-V5

home help back first fref pref prev next nref lref last post

krb5 commit: Shut down kpropd gracefully when in iprop mode

daemon@ATHENA.MIT.EDU (ghudson@mit.edu)
Mon Nov 2 22:43:57 2026

From: ghudson@mit.edu
To: cvs-krb5@mit.edu
Message-Id: <20261103034347.9EFBF105843@krbdev.mit.edu>
Date: Mon,  2 Nov 2026 22:43:47 -0500 (EST)
MIME-Version: 1.0
Reply-To: krbdev@mit.edu
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: cvs-krb5-bounces@mit.edu

https://github.com/krb5/krb5/commit/5d9782753e2e675a98d1ac139cc085dd760a77d5
commit 5d9782753e2e675a98d1ac139cc085dd760a77d5
Author: Zoltan Borbely <Zoltan.Borbely@morganstanley.com>
Date:   Tue Feb 10 19:22:36 2026 +0100

    Shut down kpropd gracefully when in iprop mode
    
    When kpropd receives a termination signal in iprop mode, defer exit
    until the next iteration of the iprop loop, to help avoid corruption
    or desynchronized state.
    
    [ghudson@mit.edu: rewrote commit message; integrated with existing
    signal handler]
    
    ticket: 9281 (new)
    tags: pullup
    target_version: 1.22-next

 src/kprop/kpropd.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/kprop/kpropd.c b/src/kprop/kpropd.c
index 4b3675264..213613b9e 100644
--- a/src/kprop/kpropd.c
+++ b/src/kprop/kpropd.c
@@ -142,6 +142,8 @@ static const char *port = KPROP_SERVICE;
 static char **db_args = NULL;
 static size_t db_args_size = 0;
 
+static volatile sig_atomic_t signal_requests_exit = 0;
+
 static void parse_args(int argc, char **argv);
 static void do_standalone(void);
 static void doit(int fd);
@@ -233,6 +235,12 @@ kill_do_standalone(int sig)
                     (int)fullprop_child);
         }
         kill(fullprop_child, sig);
+        if (sig == SIGINT || sig == SIGTERM) {
+            /* Defer termination to avoid exiting in the middle of a critical
+             * DB or ulog section. */
+            signal_requests_exit = 1;
+            return;
+        }
     }
     /* Make sure our exit status code reflects our having been signaled */
     signal_wrapper(sig, SIG_DFL);
@@ -757,6 +765,9 @@ reinit:
         incr_ret = NULL;
         full_ret = NULL;
 
+        if (signal_requests_exit)
+            goto done;
+
         /*
          * Get the most recent ulog entry sno + ts, which
          * we package in the request to the primary KDC
@@ -999,7 +1010,7 @@ done:
     ulog_fini(kpropd_context);
     krb5_free_context(kpropd_context);
 
-    return (runonce == 1) ? 0 : 1;
+    return (runonce || signal_requests_exit) ? 0 : 1;
 }
 
 
_______________________________________________
cvs-krb5 mailing list
cvs-krb5@mit.edu
https://mailman.mit.edu/mailman/listinfo/cvs-krb5

home help back first fref pref prev next nref lref last post