Hi,

I'm not sure if this should go to "puppet-users" or "mcollective-users", or 
both.  Sorry if I got it wrong.

It looks to me like there is a bug in the "runhosts" method of the 
 "puppetrunner" module of the MCollective Puppet Agent.

The bug (if that's what it it) comes into play when the user runs "mco 
puppet runall  CONCURRENCY" and some nodes are already applying a catalog.

The problem seems fairly simple:   at line 78 of the module there is this 
statement:

   host_list.push(host)

I think that should be:

   host_list.unshift(host)

You can see the relevant code here: 
https://github.com/puppetlabs/mcollective-puppet-agent/blob/master/util/puppetrunner.rb#L78
 

The code is trying to use "host_list" as a queue of host names. It takes a 
name off the queue with "host_list.pop" and if the host is not already 
applying a catalog it triggers it to do so.

It seems that if the host is busy the intention is to put it back at the 
*back* of the queue - which "unshift" would do. Instead, the "push" 
operation puts it at the head of the queue. Effectively, this is treating 
the array as a stack, not a queue.

The effect of this is simple, and not good. Once the code encounters a host 
that is busy, it "fixates" on it - pushing and popping it off the array 
until its catalog run completes. Even if every other host becomes idle, the 
code will ignore them until this particular host finishes its run.

This will not matter much in environments where the catalog run takes a 
very short time, and/or is only run very infrequently. But as the catalog 
runs take longer, and they are triggered more frequently, this can have a 
dramatic effect on how long the "runall" command takes to complete.

So, a few questions:

 -  Am I right?  Is this a bug?

 -  What should I do about this?

      (Open an issue somewhere?   Fork the code and create a pull request? 
 Something else?)


Thanks, in advance,

Lorcan Hamill



-- 
This email and any files transmitted with it are confidential and intended 
solely for the use of the individual or entity to whom they are addressed. 
If you have received this email in error please notify the system manager. 
This message contains confidential information and is intended only for the 
individual named. If you are not the named addressee you should not 
disseminate, distribute or copy this e-mail.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/fbcf3af8-fcf7-4160-aa35-f9a1b9b538a9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to