Issue #21563 has been reported by Adrien Thebo.

----------------------------------------
Bug #21563: Accessing the Puppet::Node::Environment `known_resource_types` 
instance method on multiple environments forces a regeneration of 
`known_resource_types`.
https://projects.puppetlabs.com/issues/21563

* Author: Adrien Thebo
* Status: Unreviewed
* Priority: Normal
* Assignee: 
* Category: 
* Target version: 
* Affected Puppet version: 
* Keywords: 
* Branch: 
----------------------------------------
The relationship between Puppet::Node::Environment instances and 
Puppet::Resource::TypeCollection is an n:n relationship, as every environment 
can have a unique list of known types. However there is only one instance of 
the TypeCollection present at any given time, which is stored as a thread local 
variable. Furthermore Puppet can only be run as a single thread, so this means 
that `known_resource_types` is effectively global.

Every time the [environment 
changes](https://github.com/puppetlabs/puppet/blob/3.2.1/lib/puppet/node/environment.rb#L82)
 the current known_resource_types is discarded and must be regenerated. In the 
worst case this triggers #21561; in the best case this forces Puppet to hit the 
filesystem and reread all manifests an environment. If a master has a number of 
active environments this can be very resource intensive.

It seems reasonable to make the `known_resource_types` method an instance 
variable so that if environments are switched this doesn't force a reload.


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-bugs.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to