The Puppet Labs Issue Tracker has Moved: https://tickets.puppetlabs.com

This issue tracker is now in read-only archive mode and automatic ticket export has been disabled. Redmine users will need to create a new JIRA account to file tickets using https://tickets.puppetlabs.com. See the following page for information on filing tickets with JIRA:

Bug #21043

runinterval setting in puppet.conf ignored on Windows in Puppet 3.2.1

Added by Shane Madden almost 3 years ago. Updated about 2 years ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:agent
Target version:3.2.3
Affected Puppet version:3.2.1 Branch:https://github.com/puppetlabs/puppet/pull/1725
Keywords:windows

We've Moved!

Ticket tracking is now hosted in JIRA: https://tickets.puppetlabs.com


Description

Windows agents seem to no longer pay attention to runinterval as of 3.2.1.

Currently my Windows agents have runinterval set in both the [agent] and [main] sections as a leftover workaround from #17554 – neither section works. Commenting out runinterval from one section or the other has no effect.

It’s returning the configuration correctly using (as far as I can tell) the same command as daemon.rb is using to try to retrieve it:

C:\>"c:/Program Files (x86)/Puppet Labs/Puppet/bin/puppet.bat" agent --configprint runinterval
600

But daemon.rb is somehow getting a 0 as the result to that command:

2013-06-03 16:32:26 -0600 Puppet (notice): Starting service: --debug
2013-06-03 16:32:26 -0600 Puppet (notice): Service running
2013-06-03 16:32:26 -0600 Puppet (debug): Using 'c:/Program Files (x86)/Puppet Labs/Puppet/bin/puppet.bat'
2013-06-03 16:32:28 -0600 Puppet (err): Failed to determine runinterval, defaulting to 1800 seconds
2013-06-03 16:32:28 -0600 Puppet (debug): Process created: 3100
2013-06-03 16:32:28 -0600 Puppet (debug): Service waiting for 1800 seconds

Related issues

Related to Puppet - Bug #22258: Powershell execs failing when Puppet running as service Closed
Related to Puppet - Bug #22536: windows agents don't parse runinterval as a duration setting Accepted

History

#1 Updated by Josh Cooper almost 3 years ago

  • Status changed from Unreviewed to Needs More Information

Hi Shane, can you check if you have trailing whitespace after the runinterval value in puppet.conf? We may not be trimming the value, causing the to_i conversion to fail.

#2 Updated by Shane Madden almost 3 years ago

Thanks Josh!

Verified that there’s no whitespace at the end of those lines; also tried converting from the CRLF line endings I have the Windows puppet.conf files in to LF line endings; no change.

Did some further debugging in daemon.rb, looks like I’m getting empty strings back from every %x{}.

log_debug("Using '#{puppet}'")
begin
  runinterval = %x{ "#{puppet}" agent --configprint runinterval }.to_i
  # added debugging lines:
  log_debug( %x{ "#{puppet}" agent --configprint runinterval }.class )
  log_debug( %x{ "#{puppet}" agent --configprint runinterval }.length )
  log_debug( %x{ cmd /c "echo a" }.class )
  log_debug( %x{ cmd /c "echo a" }.length )

Output from that:

2013-06-03 20:07:02 -0600 Puppet (debug): Using 'c:/Program Files (x86)/Puppet Labs/Puppet/bin/puppet.bat'
2013-06-03 20:07:06 -0600 Puppet (debug): String
2013-06-03 20:07:08 -0600 Puppet (debug): 0
2013-06-03 20:07:08 -0600 Puppet (debug): String
2013-06-03 20:07:08 -0600 Puppet (debug): 0
2013-06-03 20:07:08 -0600 Puppet (err): Failed to determine runinterval, defaulting to 1800 seconds

Something odd going on in the upgraded version of Ruby, maybe?

#3 Updated by Josh Cooper almost 3 years ago

  • Status changed from Needs More Information to Accepted

Thanks Shane, I see the behavior also, and it is due to moving to ruby 19. But it only seems to occur when running as a service. If I do the following in irb (ruby19) it works fine:

%x{ "#{puppet}" agent --configprint runinterval }.to_i

I’ll need to debug further to see why.

#4 Updated by Josh Cooper almost 3 years ago

  • Keywords set to windows

#5 Updated by Josh Cooper almost 3 years ago

We execute puppet agent --configprint runinterval in a child process, and read from the child’s stdout. This works fine in ruby 1.8, but breaks in 1.9 due to http://bugs.ruby-lang.org/issues/7239. The short term fix is to s/rubyw/ruby/ in daemon.bat

#6 Updated by Josh Cooper almost 3 years ago

  • Status changed from Accepted to In Topic Branch Pending Review
  • Target version set to 3.2.3
  • Branch set to https://github.com/puppetlabs/puppet/pull/1725

#7 Updated by Josh Partlow almost 3 years ago

  • Status changed from In Topic Branch Pending Review to Merged - Pending Release

Merged as e4f3ab3

#8 Updated by Shane Madden almost 3 years ago

Great, thanks a lot guys!

#9 Updated by Matthaus Owens almost 3 years ago

  • Status changed from Merged - Pending Release to Closed

Released in Puppet 3.2.3-rc1.

#10 Updated by Arno den Uijl over 2 years ago

Matthaus Owens wrote:

Released in Puppet 3.2.3-rc1.

Is this also fixed in the PE version? I just installed puppet-enterprise-3.0.1.msi from the site and i can’t get the runinterval to change. Looks like what is described here?!

#11 Updated by Josh Cooper over 2 years ago

Arno den Uijl wrote:

Is this also fixed in the PE version? I just installed puppet-enterprise-3.0.1.msi from the site and i can’t get the runinterval to change. Looks like what is described here?!

Are you specifying the runinterval as integer seconds, e.g. 300?

If you are specifying it as a duration, e.g. 2h, then that is bug #22536, which is not fixed in PE3.

#12 Updated by Rob Reynolds over 2 years ago

In puppet.conf:

[main]
runinterval=1

c:> puppet —version

3.3.1 (Puppet Enterprise 3.1.0)

Adding some logging to daemon.rb at https://github.com/puppetlabs/puppet/blob/master/ext/windows/service/daemon.rb#L48 and then taking a look at the output afterwards. This is the logging items added:

runintervalcommand = "\"#{puppet}\" agent --configprint runinterval"
log_notice("Running #{runintervalcommand}")
runintervaloutput = %x{ "#{puppet}" agent --configprint runinterval }
runinterval = %x{ "#{puppet}" agent --configprint runinterval }.to_i
log_notice("run interval = #{runinterval} | ouptput from command = #{runintervaloutput}")

And here is the log output in C:\ProgramData\PuppetLabs\puppet\var\log\windows.log:

2013-12-02 14:58:23 -0800 Puppet (notice): Running "C:/Program Files (x86)/Puppet Labs/Puppet Enterprise/bin/puppet.bat" agent --configprint runinterval
2013-12-02 14:58:26 -0800 Puppet (notice): run interval = 0 | ouptput from command = 
2013-12-02 14:58:26 -0800 Puppet (err): Failed to determine runinterval, defaulting to 1800 seconds
2013-12-02 14:58:26 -0800 Puppet (notice): Service waiting for 1800 seconds

This appears to be broken (at least in PE).

#13 Updated by Josh Cooper about 2 years ago

See https://tickets.puppetlabs.com/browse/PUP-58

Also available in: Atom PDF