<p>Vadim Yanitskiy has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/13313">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">hlr.c: properly terminate the process on SIGTERM<br><br>As per the systemd.kill manual, when a service is going to be<br>stopped by systemd, the process will first be terminated via<br>SIGTERM. If then, after a delay, processes still remain, the<br>the termination request is repeated with the SIGKILL.<br><br>It was observed that osmo-hlr immediately terminates on SIGTERM,<br>leaving the SQLite database open. As a result, several temporary<br>files (such as hlr.db-shm, hlr.db-wal) remain, allowing the<br>further recovery:<br><br>  DDB ERROR <0001> db.c:86 (283) recovered 10 frames from WAL file<br><br>Let's properly handle SIGTERM in the same way as we handle SIGINT.<br><br>Change-Id: I1a4a48b95bbaed74ff5a03fb5797a44bdb1fcd3a<br>---<br>M src/hlr.c<br>1 file changed, 3 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/13/13313/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/hlr.c b/src/hlr.c</span><br><span>index f374ccc..422a56d 100644</span><br><span>--- a/src/hlr.c</span><br><span>+++ b/src/hlr.c</span><br><span>@@ -612,8 +612,9 @@</span><br><span> static void signal_hdlr(int signal)</span><br><span> {</span><br><span>  switch (signal) {</span><br><span style="color: hsl(120, 100%, 40%);">+     case SIGTERM:</span><br><span>        case SIGINT:</span><br><span style="color: hsl(0, 100%, 40%);">-            LOGP(DMAIN, LOGL_NOTICE, "Terminating due to SIGINT\n");</span><br><span style="color: hsl(120, 100%, 40%);">+            LOGP(DMAIN, LOGL_NOTICE, "Terminating due to signal=%d\n", signal);</span><br><span>                quit++;</span><br><span>              break;</span><br><span>       case SIGUSR1:</span><br><span>@@ -709,6 +710,7 @@</span><br><span> </span><br><span>      osmo_init_ignore_signals();</span><br><span>  signal(SIGINT, &signal_hdlr);</span><br><span style="color: hsl(120, 100%, 40%);">+     signal(SIGTERM, &signal_hdlr);</span><br><span>   signal(SIGUSR1, &signal_hdlr);</span><br><span> </span><br><span>       if (cmdline_opts.daemonize) {</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/13313">change 13313</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/13313"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-hlr </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I1a4a48b95bbaed74ff5a03fb5797a44bdb1fcd3a </div>
<div style="display:none"> Gerrit-Change-Number: 13313 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Vadim Yanitskiy <axilirator@gmail.com> </div>