Bug 820992 - init scripts failure
init scripts failure
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: sysstat (Show other bugs)
6.2
Unspecified Unspecified
medium Severity medium
: rc
: ---
Assigned To: Peter Schiffer
Branislav Náter
: Patch
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-05-11 09:56 EDT by Petr Sklenar
Modified: 2014-07-24 07:01 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
No Documentation needed
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-11-21 16:37:17 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Petr Sklenar 2012-05-11 09:56:13 EDT
Description of problem:
init scripts failure

Version-Release number of selected component (if applicable):
sysstat-9.0.4-20.el6.x86_64

How reproducible:
deterministic

Steps to Reproduce:
:: [   LOG    ] :: >>>>>>>>> service start
:: [   PASS   ] ::  Service must start without problem
:: [   PASS   ] ::  Then Status command 
:: [   PASS   ] ::  Already started service 
:: [   PASS   ] ::  Again status command 
:: [   LOG    ] :: >>>>>>>>> service restart
:: [   PASS   ] ::  Restarting of service
:: [   PASS   ] ::  Status command 
:: [   LOG    ] :: >>>>>>>>> service stop
:: [   PASS   ] ::  Stopping service 
:: [   FAIL   ] ::  Status of stopped service  (Expected 3, got 0)
:: [   PASS   ] ::  Stopping service again 
:: [   FAIL   ] ::  Status of stopped service  (Expected 3, got 0)
:: [   LOG    ] :: >>>>>>>>> pid file
:: [   FAIL   ] :: File /var/run/sysstat.pid should exist 
:: [   FAIL   ] :: Kill sysstat (Expected 0, got 1)
:: [   FAIL   ] ::  Existing pid file, but service not started  (Expected 1, got 0)
:: [   PASS   ] :: Remove .pid file
:: [   LOG    ] :: >>>>>>>>> lock file
:: [   FAIL   ] :: File /var/lock/subsys/sysstat should exist 
:: [   FAIL   ] ::  Existing lock file, but service not started  (Expected 2, got 0)
:: [   LOG    ] :: >>>>>>>>> insufficient rights
:: [   PASS   ] ::  Starting service for restarting under nonpriv user 
:: [   FAIL   ] :: Insufficient rights, stopping service under nonprivileged user must fail (Expected 4, got 0)
:: [   FAIL   ] :: Insufficient rights, starting service under nonprivileged user must fail or pass as already started (Expected 0,4, got 2)
:: [   PASS   ] ::  Stopping service for starting under nonpriv user 
:: [   FAIL   ] :: Insufficient rights, starting of stopped service under nonprivileged user must fail (Expected 4, got 2)
:: [   LOG    ] :: >>>>>>>>> operations
:: [   PASS   ] ::  Service have to implement start function 
:: [   PASS   ] ::  Service have to implement restart function 
:: [   PASS   ] ::  Service have to implement status function 
:: [   PASS   ] ::  Service have to implement condrestart function 
:: [   PASS   ] ::  Service have to implement try-restart function 
:: [   PASS   ] ::  Service have to implement reload function 
:: [   PASS   ] ::  Service have to implement force-reload function 
:: [   LOG    ] :: >>>>>>>>> nonexist operations
:: [   PASS   ] ::  Testing proper return code when nonexisting function
:: [   LOG    ] :: Duration: 4s
:: [   LOG    ] :: Assertions: 19 good, 10 bad
:: [   FAIL   ] :: RESULT: Test


  
Actual results:
init script return wrong return code for status
pid file does not exits
lock file does not exits
wrong handling during operations like nonroot

see logs

Expected results:
lsb compliant

Additional info:
Comment 1 RHEL Product and Program Management 2012-07-10 02:23:01 EDT
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.
Comment 2 RHEL Product and Program Management 2012-07-10 21:50:39 EDT
This request was erroneously removed from consideration in Red Hat Enterprise Linux 6.4, which is currently under development.  This request will be evaluated for inclusion in Red Hat Enterprise Linux 6.4.
Comment 3 RHEL Product and Program Management 2012-09-07 01:17:43 EDT
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated
in the current release, Red Hat is unable to address this
request at this time.

Red Hat invites you to ask your support representative to
propose this request, if appropriate, in the next release of
Red Hat Enterprise Linux.
Comment 9 Branislav Náter 2013-08-27 11:52:50 EDT
Hi,

"service sysstat status" is now returning always '3'.

This is because pid file doesn't exist (it is deleted at the end of "start" action).
sysstat is kind of special daemon, actually it's not deamon:) It's not running in background (like httpd and so on). IIRC "start" action just create first record in activity file. Then it's regularly called from cron (no sysstatd in background). So I don't think it should/can handle "pid file does not exits" and "lock file does not exits" type of error.
Comment 10 Peter Schiffer 2013-08-30 10:24:42 EDT
Hi Brano,

status 3 means: "program is not running", which is kind of true in sysstat case, isn't it?

I know that sysstat "service" is pretty special, and after starting this service it's not running. However, using init scripts to do some action after boot is not that uncommon.

This patch follows LSB [1] as much as this type of service can, and is also already upstreamed for some time [2].

Anyway, what do you mean by "So I don't think it should/can handle "pid file does not exits" and "lock file does not exits" type of error."? I don't think those types of error are handled in this patch. Only questionable thing there is, is checking for pid file when running status command.. but this _theoretically_ be true when running status right after start command let's say on system with very high load, or something like that...

peter

[1] http://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/tocsysinit.html
[2] https://github.com/sysstat/sysstat/commit/0d9d19c5c4cf7a104a9c66122314db1a9808519f
Comment 11 Branislav Náter 2013-09-10 10:37:52 EDT
Hello Petr,

(In reply to Peter Schiffer from comment #10)
> Hi Brano,
> 
> status 3 means: "program is not running", which is kind of true in sysstat
> case, isn't it?
> 
> I know that sysstat "service" is pretty special, and after starting this
> service it's not running. However, using init scripts to do some action
> after boot is not that uncommon.
> 
> This patch follows LSB [1] as much as this type of service can, and is also
> already upstreamed for some time [2].
> 
> Anyway, what do you mean by "So I don't think it should/can handle "pid file
> does not exits" and "lock file does not exits" type of error."? I don't

Those are the issue reported in c#0:
Actual results:
init script return wrong return code for status
pid file does not exits
lock file does not exits

- so I meant that test used for reporting this bug will still not pass after this fix (where is expected that when you start service, pid is created, "service sysstat status" will return 0 (service is running)).

Anyway, if upstream accepted this patch, let's leave it this way.


> think those types of error are handled in this patch. Only questionable
> thing there is, is checking for pid file when running status command.. but
> this _theoretically_ be true when running status right after start command
> let's say on system with very high load, or something like that...
> 
> peter
> 
> [1]
> http://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-
> generic/tocsysinit.html
> [2]
> https://github.com/sysstat/sysstat/commit/
> 0d9d19c5c4cf7a104a9c66122314db1a9808519f

Brano
Comment 14 errata-xmlrpc 2013-11-21 16:37:17 EST
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2013-1663.html
Comment 15 Leonard den Ottolander 2014-07-24 07:01:08 EDT
What's the point of creating the $PIDFILE in the first place if you remove it immediately during startup of the service?

Makes the whole
[ -f $PIDFILE ] || RETVAL=3
in status) redundant and even erroneous as status) will return 0 if the $PIDFILE exists (which will never happen unless someone introduces a syntax error).

Just use
RETVAL=3
and forget about the $PIDFILE that only exists during start) for no apparent reason.

Note You need to log in before you can comment on or make changes to this bug.