The only way to reproduce this bug is to have the files /var/rudder/cfengine-community/{cf-execd.pid,cf-serverd.pid} empty.
During the stop process, the files are removed:
root@rudder-snapshot:~# ls -lh /var/rudder/cfengine-community/cf-*
-rw-r--r-- 1 root root 6 Apr 24 12:08 /var/rudder/cfengine-community/cf-execd.pid
-rw------- 1 root root 6 Apr 24 12:08 /var/rudder/cfengine-community/cf-serverd.pid
root@rudder-snapshot:~# /etc/init.d/rudder-agent stop
rudder-agent[28372]: [INFO] Using /etc/default/rudder-agent for configuration
rudder-agent[28375]: [INFO] Using /var/rudder/cfengine-community for CFEngine workdir
rudder-agent[28376]: [INFO] Halting CFEngine Community cf-serverd...
rudder-agent[28380]: [OK] CFEngine Community cf-serverd stopped after 2 seconds
rudder-agent[28381]: [INFO] Halting CFEngine Community cf-execd...
rudder-agent[28385]: [OK] CFEngine Community cf-execd stopped after 2 seconds
root@rudder-snapshot:~# root@rudder-snapshot:~# ls -lh /var/rudder/cfengine-community/cf-*
-bash: root@rudder-snapshot:~#: command not found
...but it is still possible to stop:
root@rudder-snapshot:~# /etc/init.d/rudder-agent stop
rudder-agent[28395]: [INFO] Using /etc/default/rudder-agent for configuration
rudder-agent[28398]: [INFO] Using /var/rudder/cfengine-community for CFEngine workdir
rudder-agent[28399]: [INFO] Halting CFEngine Community cf-serverd...
rudder-agent[28400]: [INFO] can't read PID file, not stopping cf-serverd
rudder-agent[28401]: [INFO] Halting CFEngine Community cf-execd...
rudder-agent[28402]: [INFO] can't read PID file, not stopping cf-execd
rudder-agent[28408]: [INFO] Found no CFEngine Community cf-serverd processes running
rudder-agent[28415]: [INFO] Found no CFEngine Community cf-execd processes running
If I have an empty file, the stop process will hang for a certain amount of time:
root@rudder-snapshot:~# touch /var/rudder/cfengine-community/cf-execd.pid
root@rudder-snapshot:~# /etc/init.d/rudder-agent stop
rudder-agent[28437]: [INFO] Using /etc/default/rudder-agent for configuration
rudder-agent[28441]: [INFO] Using /var/rudder/cfengine-community for CFEngine workdir
rudder-agent[28442]: [INFO] Halting CFEngine Community cf-serverd...
rudder-agent[28443]: [INFO] can't read PID file, not stopping cf-serverd
rudder-agent[28444]: [INFO] Halting CFEngine Community cf-execd...
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
If the file contain not an integer, it will just warn about an error and will delete the file (all will be OK again):
root@rudder-snapshot:~# echo "21.1" > /var/rudder/cfengine-community/cf-execd.pid
root@rudder-snapshot:~# /etc/init.d/rudder-agent stop
rudder-agent[28548]: [INFO] Using /etc/default/rudder-agent for configuration
rudder-agent[28551]: [INFO] Using /var/rudder/cfengine-community for CFEngine workdir
rudder-agent[28552]: [INFO] Halting CFEngine Community cf-serverd...
rudder-agent[28553]: [INFO] can't read PID file, not stopping cf-serverd
rudder-agent[28554]: [INFO] Halting CFEngine Community cf-execd...
/etc/init.d/rudder-agent: line 229: kill: 21.1: arguments must be process or job IDs
rudder-agent[28556]: [OK] CFEngine Community cf-execd stopped after 1 seconds
rudder-agent[28562]: [INFO] Found no CFEngine Community cf-serverd processes running
rudder-agent[28569]: [INFO] Found no CFEngine Community cf-execd processes running
root@rudder-snapshot:~# ls -lh /var/rudder/cfengine-community/cf-execd.pid
ls: cannot access /var/rudder/cfengine-community/cf-execd.pid: No such file or directory
During start, whatever the file exists or not, all will be ok:
root@rudder-snapshot:~# touch /var/rudder/cfengine-community/cf-execd.pid
root@rudder-snapshot:~# /etc/init.d/rudder-agent start
rudder-agent[28816]: [INFO] Using /etc/default/rudder-agent for configuration
rudder-agent[28820]: [INFO] Using /var/rudder/cfengine-community for CFEngine workdir
rudder-agent[28821]: [INFO] Launching CFEngine Community cf-serverd...
rudder-agent[28845]: [OK] CFEngine Community cf-serverd started after 1 seconds
rudder-agent[28846]: [INFO] Launching CFEngine Community cf-execd...
rudder-agent[28870]: [OK] CFEngine Community cf-execd started after 1 seconds
root@rudder-snapshot:~# cat /var/rudder/cfengine-community/cf-execd.pid
28867