[Bug 683640] Re: status_of_proc is returning incorrect error code
Psi-Jack
erenfro at gmail.com
Thu Oct 11 14:19:11 UTC 2012
No, actually, I'm following the LSB standards to the T.
You are correct in the fact, a process COULD be run under a different
name, and for those cases, status_of_proc should be able to be alerted
to that name, such as -n "processname", but pid files being weighted
more authority than an actual process list check is very much inaccurate
and incorrect to check the actual status of a process to whether it's
running or not.
The very point of status is to check whether a process is running or not
running. If you go strictly by a pid file if specified, and that program
dies and doesn't clean up it's mess of metadata files (which a pid file
is technically a metadata file), and you only check that, then you are
simply wrong. pid files barely even part of /the/ standards as shown:
If the status action is requested, the init script will return the following exit status codes.
0 program is running or service is OK
1 program is dead and /var/run pid file exists
2 program is dead and /var/lock lock file exists
3 program is not running
4 program or service status is unknown
5-99 reserved for future LSB use
100-149 reserved for distribution use
150-199 reserved for application use
200-254 reserved
Reference URL: http://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Core-
generic/LSB-Core-generic/iniscrptact.html
This is basically stating: If a pid file exists, check it, if it's
running and the pid file exists and is accurate as the program expected
is running, return 0.
HOWEVER,
If the pid file is missing or doesn't exist, check if the process is running by name or by binary name, if so, it's still running. Return 0
If the pid file exists and is NOT actually running, return 1
That's the root of the problem, misunderstanding of LSB init's
standards, all of which you can easily and quickly get proper
clarification from their website and from Freenode's #lsb channel which
I have already done all the research and legwork into and why I continue
to say you are wrong in this band-aid incorrect fix.
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to lsb in Ubuntu.
https://bugs.launchpad.net/bugs/683640
Title:
status_of_proc is returning incorrect error code
Status in “lsb” package in Ubuntu:
Fix Released
Status in “lsb” source package in Lucid:
Fix Committed
Status in “lsb” source package in Natty:
Won't Fix
Status in “lsb” source package in Oneiric:
Won't Fix
Status in “lsb” source package in Precise:
Fix Committed
Status in “lsb” source package in Quantal:
Fix Released
Bug description:
Binary package hint: lsb
[Impact]
When status_of_proc is called with -p $PIDFILE and the service is not presently started, error code 4 is always returned because the process does not have the PID file existant until it is started, and it's deleted after stopping.
This fails LSB compliance because it should report 0 if the service is
stopped as expected.
[Test Case]
status_of_proc should /optionally/ check if a pid file exists or not, not make it mandatory to exist before throwing an error code. If pid file does exist, check it, verify it's associated with $DAEMON, and if not try to determine if the process is actually running under a different pid, if not, then return error code 0 because it is determined that it is /not/ running.
Error code 4 in LSB is reserved for total permanent failure that
requires manual intervention to correct. Such as, the process daemon
isn't executable due to permissions, or it tried to start but fails..
error code 4 is likely never used on checking status is very basic.
Either it's running, or it's not. That's all status_of_proc should
report, nothing more, nothing less.
[Regression]
Minimal, changes the behavior of checking against a pid file existance.
ProblemType: Bug
DistroRelease: Ubuntu 10.04
Package: lsb-base 4.0-0ubuntu8
ProcVersionSignature: Ubuntu 2.6.32-26.48-server 2.6.32.24+drm33.11
Uname: Linux 2.6.32-26-server x86_64
Architecture: amd64
Date: Wed Dec 1 08:27:21 2010
InstallationMedia: Ubuntu-Server 10.04.1 LTS "Lucid Lynx" - Release amd64 (20100816.2)
PackageArchitecture: all
ProcEnviron:
LANG=en_US.UTF-8
SHELL=/bin/bash
SourcePackage: lsb
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/lsb/+bug/683640/+subscriptions
More information about the foundations-bugs
mailing list