Bug #5246
Puppetd does not remove it's pidfile when it exits
| Status: | Closed | Start date: | 11/09/2010 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | - | % Done: | 0% |
|
| Category: | agent | |||
| Target version: | 2.7.10 | |||
| Affected Puppet version: | 2.6.2 | Branch: | ||
| Keywords: | mcollective | |||
| Votes: | 4 |
Description
When running puppetd it should delete its pid file when it exits
root 20572 2.0 0.5 116736 35256 ? Ss 23:10 0:00 /usr/bin/ruby /usr/sbin/puppetd --onetime --splaylimit 30 --splay
The pid file /var/run/puppet/agent.pid would have 20572 as expected, the puppet run completes ok:
Nov 9 23:11:27 xen1 puppet-agent[20572]: Finished catalog run in 19.68 seconds
But it leaves the pid file on the disk after exiting
History
Updated by Andrew Forgue over 1 year ago
I have seen this before as well.
0,30 * * * * /usr/local/bin/puppet agent --splay --onetime >/dev/null 2>&1
However it seems to be an issue if the catalog finished before the next cron run, but the report is bing submitted.
Here’s a rudimentary timeline..
:00 - puppet agent --onetime --splay :29:00 - catalog retrival :29:56 - catalog finishes :30 - puppet agent --onetime --splay (Run of Puppet configuration client already in progress; skipping) :30:xx - report submitted, original process ends
From here, puppet will never run again and I have to manually delete the pid file.
I’m not sure if this is the same issue as RI, but it’s the first one that showed up when searching and sounded familiar.
Updated by Andrew Forgue over 1 year ago
The PID that winds up in the /var/lib/puppet/run/agent.pid is the pid from the run at :30:00 in my above example.
Updated by Nigel Kersten over 1 year ago
- Status changed from Unreviewed to Accepted
- Priority changed from Normal to High
- Target version set to 2.7.x
Updated by R.I. Pienaar about 1 year ago
- Keywords set to mcollective
Updated by Hunter Haugen 7 months ago
Currently confirmed on Puppet 2.6.4 shipped with PE 1.2 as well as the last merge of 2.7.x, commit 25213bfcd0c3bf1b5b59131d91490268b4949374.
If
puppet agent --onetimeis run, it drops a pid file and doesn’t clean it up.If
puppet agent --onetime --no-daemonizeis run then it never places a pid file.If
puppet agentis forked into the background and killed viakillthen it cleans up its pid file.
Updated by Hunter Haugen 7 months ago
The onetime method in lib/puppet/application/agent.rb calls @agent.run which daemonizes and creates the PID, but then just exits with 0, 1, or :details_exitcodes instead of agent process or calling @daemon.stop.
If you call @daemon.stop right before if not report (line 324) then it seems to be the desired behaviour, but I haven’t thoroughly search out the matter.
Updated by Daniel Pittman 4 months ago
- Category set to agent
- Priority changed from High to Normal
Updated by R.I. Pienaar 4 months ago
I concur with Hunter, have tested (actually didnt see his comment and came to the same fix independently)
Add @daemon.stop(:exit => false) before the checks on report and the various exit code behaviors in the Puppet::Application::Agent#onetime method and that sorts it all out.
Updated by R.I. Pienaar 4 months ago
- Status changed from Accepted to In Topic Branch Pending Review
https://github.com/puppetlabs/puppet/pull/327
Updated by R.I. Pienaar 4 months ago
- Status changed from In Topic Branch Pending Review to Merged - Pending Release
Updated by R.I. Pienaar 4 months ago
Dan: I just noticed I did that onto 2.6.x, how do we ensure this also go into 2.7.x? New to the process and all..
Updated by Daniel Pittman 4 months ago
R.I. Pienaar wrote:
Dan: I just noticed I did that onto 2.6.x, how do we ensure this also go into 2.7.x? New to the process and all..
Best practice is to commit to the oldest version you want to include the fix. We merge all changes up on a regular basis, 2.6 –> 2.7 –> telly, so it will get merged up soon. (Before the next 2.7 release, specifically.)
Updated by Michael Stahnke 4 months ago
- Status changed from Merged - Pending Release to Closed
- Target version changed from 2.7.x to 2.7.10
released in 2.7.10rc1