Details
Description
If Puppet is running on a Solaris server as an SMF service, and starts a long-running process - e.g. it starts a daemon via an init script - that process is within the same "contract" as the Puppet agent process. If the Puppet agent is stopped/restarted, SMF waits for the *contract* to finish, not just the agent process. As the daemon doesn't terminate, the contract doesn't finish within the configured timeout, and so SMF puts the service into "maintenance" state and sends *kill -9* to all processes still left in the contract.
It is possible to force a process to run in a new contract (e.g. using "/usr/bin/ctrun") and it would be useful if Puppet could support this on Solaris, so that the agent can be stopped/restarted without affecting services that it manages.
Steps to reproduce:
1. Configure and run a puppet agent as an SMF service (using the default "contract" model of service management).
(For example, install & configure the OpenCSW Puppet package)
2. Set puppet to manage a daemon that is started by an init script.
3. Try to stop the puppet agent.
4. Observe (from the service log files, server's messages file, and process listings) that the init-controlled daemon has been killed and the puppet agent service placed into "maintenance" state.
In my test scenario, Puppet was starting an exim daemon via an init script.
# ptree -c
|
[process contract 1]
|
1 /sbin/init
|
[process contract 4]
|
7 /lib/svc/bin/svc.startd
|
[...]
|
[process contract 3431]
|
4056 ./exim -bd -q1m
|
4138 /opt/csw/bin/ruby18 /opt/csw/sbin/puppetd
|
4270 pkgserv -N pkginfo
|
|
# svcadm disable cswpuppetd
|
# tail -f /var/svc/log/network-cswpuppetd:default.log
|
[ Nov 12 17:48:27 Stopping because service disabled. ]
|
[ Nov 12 17:48:27 Executing stop method ("/var/opt/csw/svc/method/svc-cswpuppetd stop") ]
|
Stopping Puppet client services: puppetd
|
[ Nov 12 17:48:32 Method "stop" exited with status 0 ]
|
[ Nov 12 17:49:27 Method or service exit timed out. Killing contract 3431 ]
|
^C
|
# ps -ef | grep exim
|
root 4394 2825 0 18:03:13 pts/1 0:00 grep exim
|
# svcs -vx
|
svc:/network/cswpuppetd:default (?)
|
State: maintenance since Mon Nov 12 17:49:28 2012
|
Reason: Method failed.
|
See: http://sun.com/msg/SMF-8000-8Q
|
See: /var/svc/log/network-cswpuppetd:default.log
|
Impact: This service is not running.
|
|