PUP-2987 (which shipped with Puppet open source 3.7.0), we addressed an issue with service hangs on Windows that could prevent Puppet from properly uninstalling.
Since the agent upgrade module supports installing from these older PE versions which may have this bug in the service code, to properly upgrade an agent, it may be necessary to forcefully terminate the processes associated with the puppet, pe-puppet, mcollective or pe-mcollective services.
For users who encounter this issue, it's a major pain, because it requires manual intervention to remediate. Such manual intervention does not scale.
The Azure extension handler employs a work-around prior to uninstall, it tries to gracefully stop services, and then forcefully kills them if their PIDs are still running after a certain timeout period.
Based on how the upgrade process works, such a workaround would have to be put in the batch file at https://github.com/puppetlabs/puppetlabs-puppet_agent/blob/master/templates/install_puppet.bat.erb
After waiting on the Puppet run to exit, the next steps would be to:
- retrieve PIDs for running service processes
- ask all services to shut-down
- requery services in a similar timeout loop as the one used for waiting on the parent agent run
- terminate processes by ID that are still running, logging any such instances to the event log