Change in osmo-hlr[master]: hlr.c: properly terminate the process on SIGTERM

Harald Welte gerrit-no-reply at
Tue Mar 19 12:54:42 UTC 2019

Harald Welte has submitted this change and it was merged. ( )

Change subject: hlr.c: properly terminate the process on SIGTERM

hlr.c: properly terminate the process on SIGTERM

As per the systemd.kill manual, when a service is going to be
stopped by systemd, the process will first be terminated via
SIGTERM. If then, after a delay, processes still remain, the
the termination request is repeated with the SIGKILL.

It was observed that osmo-hlr immediately terminates on SIGTERM,
leaving the SQLite database open. As a result, several temporary
files (such as hlr.db-shm, hlr.db-wal) remain, allowing the
further recovery:

  DDB ERROR <0001> db.c:86 (283) recovered 10 frames from WAL file

Let's properly handle SIGTERM in the same way as we handle SIGINT.

Change-Id: I1a4a48b95bbaed74ff5a03fb5797a44bdb1fcd3a
M src/hlr.c
1 file changed, 3 insertions(+), 1 deletion(-)

  Jenkins Builder: Verified
  Pau Espin Pedrol: Looks good to me, approved
  Harald Welte: Looks good to me, approved

diff --git a/src/hlr.c b/src/hlr.c
index f374ccc..422a56d 100644
--- a/src/hlr.c
+++ b/src/hlr.c
@@ -612,8 +612,9 @@
 static void signal_hdlr(int signal)
 	switch (signal) {
+	case SIGTERM:
 	case SIGINT:
-		LOGP(DMAIN, LOGL_NOTICE, "Terminating due to SIGINT\n");
+		LOGP(DMAIN, LOGL_NOTICE, "Terminating due to signal=%d\n", signal);
 	case SIGUSR1:
@@ -709,6 +710,7 @@
 	signal(SIGINT, &signal_hdlr);
+	signal(SIGTERM, &signal_hdlr);
 	signal(SIGUSR1, &signal_hdlr);
 	if (cmdline_opts.daemonize) {

To view, visit
To unsubscribe, or for help writing mail filters, visit

Gerrit-Project: osmo-hlr
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I1a4a48b95bbaed74ff5a03fb5797a44bdb1fcd3a
Gerrit-Change-Number: 13313
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy <axilirator at>
Gerrit-Reviewer: Harald Welte <laforge at>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Max <msuraev at>
Gerrit-Reviewer: Pau Espin Pedrol <pespin at>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the gerrit-log mailing list