View Issue Details

IDProjectCategoryView StatusLast Update
0000386bareos-coreGeneralpublic2015-03-25 19:19
Reportertigerfoot Assigned To 
PrioritylowSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
PlatformopenSUSEOSopenSUSEOS Version13.1
Product Version14.2.2 
Fixed in Version14.4.0 
Summary0000386: rfe Add special SIGNAL to service unit (systemd) to support correctly normal exit status
DescriptionActually when bareos daemon receive a sigterm systemd consider the service in fail state.
The daemon return the signal it has received (in case of normal stop 15)
code=exited, status=15

For example
yoda:~ # systemctl stop bareos-fd.service
yoda:~ # systemctl status bareos-fd.service
bareos-fd.service - Bareos File Daemon service
   Loaded: loaded (/etc/systemd/system/bareos-fd.service; enabled)
   Active: failed (Result: exit-code) since ven 2014-12-26 12:08:57 CET; 5s ago
  Process: 4613 ExecStart=/usr/sbin/bareos-fd -c /etc/bareos/bareos-fd.conf (code=exited, status=0/SUCCESS)
 Main PID: 4639 (code=exited, status=15)

déc 24 07:04:24 yoda systemd[1]: Starting Bareos File Daemon service...
déc 24 07:04:24 yoda systemd[1]: PID file /var/run/bareos/bareos-fd.9102.pid not readable (yet?) after start.
déc 24 07:04:24 yoda systemd[1]: Started Bareos File Daemon service.
déc 26 12:08:57 yoda systemd[1]: Stopping Bareos File Daemon service...
déc 26 12:08:57 yoda bareos-fd[4639]: Shutting down BAREOS service: yoda-fd ...
déc 26 12:08:57 yoda systemd[1]: bareos-fd.service: main process exited, code=exited, status=15/n/a
déc 26 12:08:57 yoda systemd[1]: Stopped Bareos File Daemon service.
déc 26 12:08:57 yoda systemd[1]: Unit bareos-fd.service entered failed state.

with adding the line
SuccessExitStatus=0 15
in the service file the result is better.

systemctl status bareos-fd.service
bareos-fd.service - Bareos File Daemon service
   Loaded: loaded (/etc/systemd/system/bareos-fd.service; enabled)
   Active: active (running) since Fri 2014-12-26 12:06:40 CET; 2s ago
     Docs: man:bareos-fd(8)
  Process: 20101 ExecStart=/usr/sbin/bareos-fd -c /etc/bareos/bareos-fd.conf (code=exited, status=0/SUCCESS)
 Main PID: 20102 (bareos-fd)
   CGroup: /system.slice/bareos-fd.service
           └─20102 /usr/sbin/bareos-fd -c /etc/bareos/bareos-fd.conf

Dec 26 12:06:40 c-3po.labaroche.ioda.net systemd[1]: Starting Bareos File Daemon service...
Dec 26 12:06:40 c-3po.labaroche.ioda.net systemd[1]: Started Bareos File Daemon service.
c-3po:/etc/systemd/system # systemctl stop bareos-fd.service
c-3po:/etc/systemd/system # systemctl status bareos-fd.service
bareos-fd.service - Bareos File Daemon service
   Loaded: loaded (/etc/systemd/system/bareos-fd.service; enabled)
   Active: inactive (dead) since Fri 2014-12-26 12:06:59 CET; 1s ago
     Docs: man:bareos-fd(8)
  Process: 20101 ExecStart=/usr/sbin/bareos-fd -c /etc/bareos/bareos-fd.conf (code=exited, status=0/SUCCESS)
 Main PID: 20102 (code=exited, status=15)

Dec 26 12:06:40 c-3po.labaroche.ioda.net systemd[1]: Starting Bareos File Daemon service...
Dec 26 12:06:40 c-3po.labaroche.ioda.net systemd[1]: Started Bareos File Daemon service.
Dec 26 12:06:59 c-3po.labaroche.ioda.net systemd[1]: Stopping Bareos File Daemon service...
Dec 26 12:06:59 c-3po.labaroche.ioda.net bareos-fd[20102]: Shutting down BAREOS service: c-3po-fd ...
Dec 26 12:06:59 c-3po.labaroche.ioda.net systemd[1]: Stopped Bareos File Daemon service.
Steps To Reproducesee description
Additional InformationThe benefit is also that systemd will not try to trigger automatically a restart when the restartonfailure is on
Auto-completion of the unit will stil work.

Need to define all the "normal" exit case in all daemon to include them.

Patch could be then added.
TagsNo tags attached.
bareos-master: impact
bareos-master: action
bareos-19.2: impact
bareos-19.2: action
bareos-18.2: impact
bareos-18.2: action
bareos-17.2: impact
bareos-17.2: action
bareos-16.2: impact
bareos-16.2: action
bareos-15.2: impact
bareos-15.2: action
bareos-14.2: impactyes
bareos-14.2: actionfixed
bareos-13.2: impact
bareos-13.2: action
bareos-12.4: impact
bareos-12.4: action

Relationships

child of 0000393 closed Release bareos-14.2.3 

Activities

mvwieringen

mvwieringen

2014-12-29 16:47

developer   ~0001169

Yes bacula and as such bareos exits with an exit code that represents the
signal received. Its seems systemd has a other idea of how signal handling
should work and you should catch your signal do post-processing and then
remove the signal handler and then send the signal once again and let the
the default handler cleanup your running process.

For now I think adding the also clean exit codes like 15 makes sense.
Write a patch and attach it to the bug and then we can merge it into master
and see how it works out there.
tigerfoot

tigerfoot

2015-01-04 09:54

developer  

Fix-386_make-systemd-aware-of-normal-exit-status.patch (1,999 bytes)   
From 2e62972276840603cf1b194e6097a30e07a507d6 Mon Sep 17 00:00:00 2001
From: Bruno Friedmann <bruno@ioda-net.ch>
Date: Sun, 4 Jan 2015 09:47:30 +0100
Subject: [PATCH 1/1] Make systemd aware of normal daemon exit status, so
 service are in success state after stop or restart

---
 platforms/systemd/bareos-dir.service.in | 1 +
 platforms/systemd/bareos-fd.service.in  | 1 +
 platforms/systemd/bareos-sd.service.in  | 1 +
 3 files changed, 3 insertions(+)

diff --git a/platforms/systemd/bareos-dir.service.in b/platforms/systemd/bareos-dir.service.in
index 0ebed66..c94d17c 100644
--- a/platforms/systemd/bareos-dir.service.in
+++ b/platforms/systemd/bareos-dir.service.in
@@ -34,6 +34,7 @@ PIDFile=@piddir@/bareos-dir.@dir_port@.pid
 # StandardOutput=syslog
 ExecStartPre=@sbindir@/bareos-dir -c @confdir@/bareos-dir.conf -t -f
 ExecStart=@sbindir@/bareos-dir -c @confdir@/bareos-dir.conf
+SuccessExitStatus=0 1 15
 # This daemon should be able to reload the conf file
 #ExecReload=/sbin/killproc -p @piddir@/bareos-dir.pid -HUP @sbindir@/bareos-dir
 #Restart=on-failure
diff --git a/platforms/systemd/bareos-fd.service.in b/platforms/systemd/bareos-fd.service.in
index 1cde296..5713d6c 100644
--- a/platforms/systemd/bareos-fd.service.in
+++ b/platforms/systemd/bareos-fd.service.in
@@ -28,6 +28,7 @@ WorkingDirectory=@working_dir@
 PIDFile=@piddir@/bareos-fd.@fd_port@.pid
 StandardOutput=syslog
 ExecStart=@sbindir@/bareos-fd -c @confdir@/bareos-fd.conf
+SuccessExitStatus=0 15
 Restart=on-failure
 # IOSchedulingClass=idle
 
diff --git a/platforms/systemd/bareos-sd.service.in b/platforms/systemd/bareos-sd.service.in
index d6d8ab9..fd88d75 100644
--- a/platforms/systemd/bareos-sd.service.in
+++ b/platforms/systemd/bareos-sd.service.in
@@ -29,6 +29,7 @@ PIDFile=@piddir@/bareos-sd.@sd_port@.pid
 # EnvironmentFile=-/etc/sysconfig/bareos-sd
 StandardOutput=syslog
 ExecStart=@sbindir@/bareos-sd -c @confdir@/bareos-sd.conf
+SuccessExitStatus=0 15
 Restart=on-failure
 
 [Install]
-- 
1.8.4.5

tigerfoot

tigerfoot

2015-01-04 09:54

developer   ~0001172

Find attached patch against current master branch
(Should be easy to backport)

I found that bareos-dir need also signal 1 to have success when doing a restart.
maik

maik

2015-01-19 12:38

administrator   ~0001198

fixed in master with changeset c862034f
mvwieringen

mvwieringen

2015-03-25 16:51

developer   ~0001447

Fix committed to bareos2015 bareos-14.2 branch with changesetid 4471.
joergs

joergs

2015-03-25 19:19

developer   ~0001599

Due to the reimport of the Github repository to bugs.bareos.org, the status of some tickets have been changed. These tickets will be closed again.
Sorry for the noise.

Related Changesets

bareos: master c862034f

2015-01-04 09:47:30

Bruno Friedmann


Committer: Marco van Wieringen

Ported: N/A

Details Diff
Make systemd aware of normal daemon exit status

Make systemd aware of normal daemon exit status, so service are in
success state after stop or restart.

Fixes 0000386: Add special SIGNAL to service unit (systemd) to support
correctly normal exit status

Signed-off-by: Marco van Wieringen <marco.van.wieringen@bareos.com>
Affected Issues
0000386
mod - platforms/systemd/bareos-dir.service.in Diff File
mod - platforms/systemd/bareos-fd.service.in Diff File
mod - platforms/systemd/bareos-sd.service.in Diff File

bareos: bareos-14.2 93a53997

2015-01-04 09:47:30

Bruno Friedmann


Committer: Joerg Steffens

Ported: master

Details Diff
Make systemd aware of normal daemon exit status

Make systemd aware of normal daemon exit status, so service are in
success state after stop or restart.

Fixes 0000386: Add special SIGNAL to service unit (systemd) to support
correctly normal exit status

Signed-off-by: Marco van Wieringen <marco.van.wieringen@bareos.com>
Affected Issues
0000386
mod - platforms/systemd/bareos-dir.service.in Diff File
mod - platforms/systemd/bareos-fd.service.in Diff File
mod - platforms/systemd/bareos-sd.service.in Diff File

bareos2015: bareos-14.2 3396bc10

2015-01-04 09:47:30

tigerfoot


Committer: mvwieringen

Ported: N/A

Details Diff
Make systemd aware of normal daemon exit status

Make systemd aware of normal daemon exit status, so service are in
success state after stop or restart.

Fixes 0000386: Add special SIGNAL to service unit (systemd) to support
correctly normal exit status

Signed-off-by: Marco van Wieringen <marco.van.wieringen@bareos.com>
Affected Issues
0000386
mod - platforms/systemd/bareos-dir.service.in Diff File
mod - platforms/systemd/bareos-fd.service.in Diff File
mod - platforms/systemd/bareos-sd.service.in Diff File

Issue History

Date Modified Username Field Change
2014-12-26 12:15 tigerfoot New Issue
2014-12-29 16:47 mvwieringen Note Added: 0001169
2014-12-29 16:47 mvwieringen Assigned To => mvwieringen
2014-12-29 16:47 mvwieringen Status new => feedback
2014-12-29 16:48 mvwieringen Assigned To mvwieringen =>
2015-01-04 09:54 tigerfoot File Added: Fix-386_make-systemd-aware-of-normal-exit-status.patch
2015-01-04 09:54 tigerfoot Note Added: 0001172
2015-01-04 09:54 tigerfoot Status feedback => new
2015-01-19 12:07 mvwieringen Changeset attached => bareos master c862034f
2015-01-19 12:38 maik Note Added: 0001198
2015-01-19 12:38 maik Status new => resolved
2015-01-19 12:38 maik Resolution open => fixed
2015-01-19 12:38 maik Assigned To => maik
2015-01-23 11:12 joergs Relationship added child of 0000393
2015-01-23 11:49 joergs Assigned To maik =>
2015-01-23 11:49 joergs Fixed in Version => 14.4.0
2015-02-02 10:25 joergs Changeset attached => bareos bareos-14.2 93a53997
2015-02-02 10:25 joergs bareos-14.2: impact => yes
2015-02-02 10:25 joergs bareos-14.2: action => fixed
2015-03-25 16:51 mvwieringen Changeset attached => bareos2015 bareos-14.2 3396bc10
2015-03-25 16:51 mvwieringen Note Added: 0001447
2015-03-25 19:19 joergs Note Added: 0001599
2015-03-25 19:19 joergs Status resolved => closed