From 185995ee862fe92bb475c5fc4d9f490f75646cb3 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Fri, 21 Aug 2026 12:51:30 +0200 Subject: [PATCH 1/2] notify systemd after increasing the restart counter Signed-off-by: Tim Meusel --- src/puppetlabs/trapperkeeper/internal.clj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/puppetlabs/trapperkeeper/internal.clj b/src/puppetlabs/trapperkeeper/internal.clj index ec8b0ca..4b76b49 100644 --- a/src/puppetlabs/trapperkeeper/internal.clj +++ b/src/puppetlabs/trapperkeeper/internal.clj @@ -797,8 +797,8 @@ (a/start [this] (run-lifecycle-fns app-context s/start "start" ordered-services) (enable-ready-notifications-for-app! services-by-id) - (notice-service-ready-if-uncoordinated! services-by-id) (inc-restart-counter! this) + (notice-service-ready-if-uncoordinated! services-by-id) this) (a/stop [this] (a/stop this false)) @@ -820,9 +820,9 @@ (run-lifecycle-fns app-context s/init "init" ordered-services) (run-lifecycle-fns app-context s/start "start" ordered-services) (enable-ready-notifications-for-app! services-by-id) + (inc-restart-counter! this) (notice-service-ready-if-uncoordinated! services-by-id) (log/info (i18n/trs "Finished restart for TK {0}" (app-log-id this))) - (inc-restart-counter! this) this (catch Throwable t (deliver shutdown-reason-promise {:cause :service-error From 0a647a7d285e3454eb58f4add3d2b6fe04cea30f Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Fri, 21 Aug 2026 15:07:30 +0200 Subject: [PATCH 2/2] send STOPPING during JVM shutdown This codepath is triggered during a `systemctl restart puppetserver` or `systemctl stop puppetserver`. Signed-off-by: Tim Meusel --- src/puppetlabs/trapperkeeper/internal.clj | 1 + 1 file changed, 1 insertion(+) diff --git a/src/puppetlabs/trapperkeeper/internal.clj b/src/puppetlabs/trapperkeeper/internal.clj index 4b76b49..62923b3 100644 --- a/src/puppetlabs/trapperkeeper/internal.clj +++ b/src/puppetlabs/trapperkeeper/internal.clj @@ -671,6 +671,7 @@ (ks/add-shutdown-hook! (fn [] (when-not (realized? shutdown-reason-promise) (log/info (i18n/trs "Shutting down due to JVM shutdown hook.")) + (notice-service-stopping) (shutdown! app-context) (deliver shutdown-reason-promise {:cause :jvm-shutdown-hook})))) shutdown-service))