Bug #6447
ps -ef is parsed incorrectly by service/base.rb (trivial bug)
| Status: | Needs More Information | Start date: | 02/24/2011 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | % Done: | 0% |
||
| Category: | service | |||
| Target version: | - | Estimated time: | 1.00 hour | |
| Affected Puppet version: | 0.25.5 | Branch: | ||
| Keywords: | ||||
| Votes: | 0 |
Description
regex matches ps -ef output in any place, resulting false positives when username coincides with process name, ie.
debug: Servicenagios: Executing ‘ps -ef’ debug: Servicenagios: PID is 13873
<0>root@893(13)/usr/lib/ruby/site_ruby/1.8/puppet$ ps -ef|grep 13873 nagios 13873 1 0 14:20 ? 00:00:00 nrpe -c /etc/nagios/nrpe.cfg -d root 20625 20304 0 15:29 pts/1 00:00:00 grep 13873
process nagios is obvously mistaken with user nagios. service type keeps calling service nagios stop, while it’s not running.
either fix regex or change to “ps -efn”
workaround export FACTER_ps="ps -efn" doesn’t work.
History
Updated by konrad rzentarzewski about 1 year ago
proper formatting (sorry, can’t find a way to edit the bug)
debug: Service[nagios](provider=redhat): Executing 'ps -ef'
debug: Service[nagios](provider=redhat): PID is 13873
<0>root@893(4)~$ ps auxwwwf|grep 13873
root 20410 0.0 0.0 61152 668 pts/1 S<+ 15:17 0:00 \_ grep 13873
nagios 13873 0.0 0.0 38296 740 ? S<s 14:20 0:00 nrpe -c /etc/nagios/nrpe.cfg -d
Updated by konrad rzentarzewski about 1 year ago
after a bit more of thinking i have to admit it’s not so trivial – currently getpid() recklessly assumes that process running in ps table is called the same as service (ie. in sysVinit in RH). this is not always true, ie. for commercial packages utilising sysVinit scripts launching jre/jdk application.
Updated by Zach Leslie about 1 year ago
- Status changed from Unreviewed to Accepted
Updated by James Turnbull about 1 year ago
- Status changed from Accepted to Needs Decision
- Assignee set to Nigel Kersten
Updated by James Turnbull about 1 year ago
- Target version deleted (
2.6.5)
Updated by Nigel Kersten 6 months ago
- Status changed from Needs Decision to Needs More Information
- Assignee changed from Nigel Kersten to konrad rzentarzewski
I can’t quite see what the action item is here.
Updated by konrad rzentarzewski 6 months ago
- Assignee changed from konrad rzentarzewski to Nigel Kersten
in service type, getpid method uses “ps” to get a pid of running process in default provider. by default it searches for string equal to either service binary or name.
“ps -ef” (as given by facter) is used to get process table.
now consider service foo, running by user bar and service bar running by user baz.
if foo service is running and bar service is not, puppet will return that both services are running, because in process table foo service consist substring “bar” – username under which process is running.
expected behaviour is to return running only services which are actually running.
is it clear now?