Issue #21376 has been updated by Andrew Parker.

After looking into this, it looks like the recursion is occuring from repeated 
calls into `BlockExpression`, which has been setup by calls to 
`Puppet::Resource::Type#merge` 
(<https://github.com/puppetlabs/puppet/blob/53241a91c687336a273291aa6e71f90fc7752581/lib/puppet/resource/type.rb#L194>).
 Repeated calls to `#merge` will result in larger and larger chains of 
recursive calls in `BlockExpression`. It appears that `#merge` is called in 
`Puppet::Resource::TypeCollection#add` 
(<https://github.com/puppetlabs/puppet/blob/2624eee7b3a6443700a4984e72782735e08192c4/lib/puppet/resource/type_collection.rb#L46>).

I think that what is occurring is that whenever a manifest is loaded a new 
`Class[main]` is created and then merged into the existing `Class[main]`. When 
`Class[main]` gets evaluated, then we end up with a stack overflow if there 
have been enough manifests loaded. This has not yet been confirmed.

----------------------------------------
Bug #21376: Stack level too deep after updating from 3.1.1 to 3.2.2
https://projects.puppetlabs.com/issues/21376#change-93217

* Author: Peter Meier
* Status: Unreviewed
* Priority: High
* Assignee: 
* Category: 
* Target version: 
* Affected Puppet version: 
* Keywords: 
* Branch: 
----------------------------------------
After updating my master from 3.1.1 to 3.2.2 I started getting failing clients 
with stack level too deep. These failures happen rather randomly and only after 
a while. So usually after the master is running for a while it will start 
failing for certain nodes.

The error I get is
<pre>
    stack level too deep
    /usr/lib/ruby/site_ruby/1.8/puppet/util/errors.rb:23:in `adderrorcontext'
    /usr/lib/ruby/site_ruby/1.8/puppet/parser/ast.rb:64:in `safeevaluate'
    /usr/lib/ruby/site_ruby/1.8/puppet/parser/ast/block_expression.rb:15:in 
`evaluate'
    /usr/lib/ruby/site_ruby/1.8/puppet/parser/ast/block_expression.rb:10:in 
`each'
    /usr/lib/ruby/site_ruby/1.8/puppet/parser/ast/block_expression.rb:10:in 
`evaluate'
    /usr/lib/ruby/site_ruby/1.8/puppet/parser/ast.rb:62:in `safeevaluate'
    /usr/lib/ruby/site_ruby/1.8/puppet/parser/ast/block_expression.rb:15:in 
`evaluate'
    /usr/lib/ruby/site_ruby/1.8/puppet/parser/ast/block_expression.rb:10:in 
`each'
    /usr/lib/ruby/site_ruby/1.8/puppet/parser/ast/block_expression.rb:10:in 
`evaluate'
     
    [...]
     
    /usr/lib/ruby/site_ruby/1.8/puppet/parser/ast/block_expression.rb:15:in 
`evaluate'
    /usr/lib/ruby/site_ruby/1.8/puppet/parser/ast/block_expression.rb:10:in 
`each'
    /usr/lib/ruby/site_ruby/1.8/puppet/parser/ast/block_expression.rb:10:in 
`evaluate'
    /usr/lib/ruby/site_ruby/1.8/puppet/parser/ast.rb:62:in `safeevaluate'
    /usr/lib/ruby/site_ruby/1.8/puppet/parser/ast/block_expression.rb:15:in 
`evaluate'
    /usr/lib/ruby/site_ruby/1.8/puppet/parser/ast/block_expression.rb:10:in 
`each'
    /usr/lib/ruby/site_ruby/1.8/puppet/parser/ast/block_expression.rb:10:in 
`evaluate'
    /usr/lib/ruby/site_ruby/1.8/puppet/parser/ast.rb:62:in `safeevaluate'
    /usr/lib/ruby/site_ruby/1.8/puppet/parser/ast/block_expression.rb:15:in 
`evaluate'
    /usr/lib/ruby/site_ruby/1.8/puppet/parser/ast/block_expression.rb:10:in 
`each'
    /usr/lib/ruby/site_ruby/1.8/puppet/parser/ast/block_expression.rb:10:in 
`evaluate'
    /usr/lib/ruby/site_ruby/1.8/puppet/parser/ast.rb:62:in `safeevaluate'
    /usr/lib/ruby/site_ruby/1.8/puppet/resource/type.rb:137:in `evaluate_code'
    /usr/lib/ruby/site_ruby/1.8/puppet/parser/resource.rb:81:in `evaluate'
    /usr/lib/ruby/site_ruby/1.8/puppet/parser/compiler.rb:293:in `evaluate_main'
    /usr/lib/ruby/site_ruby/1.8/puppet/parser/compiler.rb:97:in `compile'
    /usr/lib/ruby/site_ruby/1.8/puppet/util/profiler/none.rb:6:in `profile'
    /usr/lib/ruby/site_ruby/1.8/puppet/util/profiler.rb:26:in `profile'
    /usr/lib/ruby/site_ruby/1.8/puppet/parser/compiler.rb:97:in `compile'
    /usr/lib/ruby/site_ruby/1.8/puppet/parser/compiler.rb:29:in `compile'
    /usr/lib/ruby/site_ruby/1.8/puppet/indirector/catalog/compiler.rb:86:in 
`compile'
    /usr/lib/ruby/site_ruby/1.8/puppet/util/profiler/none.rb:6:in `profile'
    /usr/lib/ruby/site_ruby/1.8/puppet/util/profiler.rb:26:in `profile'
    /usr/lib/ruby/site_ruby/1.8/puppet/indirector/catalog/compiler.rb:84:in 
`compile'
    /usr/lib/ruby/site_ruby/1.8/puppet/indirector/catalog/compiler.rb:44:in 
`find'
    /usr/lib/ruby/site_ruby/1.8/puppet/indirector/indirection.rb:197:in `find'
    /usr/lib/ruby/site_ruby/1.8/puppet/network/http/handler.rb:128:in `do_find'
    /usr/lib/ruby/site_ruby/1.8/puppet/network/http/handler.rb:88:in `send'
    /usr/lib/ruby/site_ruby/1.8/puppet/network/http/handler.rb:88:in `process'
    /usr/lib/ruby/site_ruby/1.8/puppet/util/profiler/none.rb:6:in `profile'
    /usr/lib/ruby/site_ruby/1.8/puppet/util/profiler.rb:26:in `profile'
    /usr/lib/ruby/site_ruby/1.8/puppet/network/http/handler.rb:82:in `process'
    /usr/lib/ruby/site_ruby/1.8/puppet/network/http/rack.rb:21:in `call'
    
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/rack/request_handler.rb:96:in
 `process_request'
    
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/abstract_request_handler.rb:516:in
 `accept_and_process_next_request'
    
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/abstract_request_handler.rb:274:in
 `main_loop'
    
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/rack/application_spawner.rb:206:in
 `start_request_handler'
    
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/rack/application_spawner.rb:171:in
 `send'
    
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/rack/application_spawner.rb:171:in
 `handle_spawn_application'
    
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/utils.rb:470:in
 `safe_fork'
    
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/rack/application_spawner.rb:166:in
 `handle_spawn_application'
    
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server.rb:357:in
 `__send__'
    
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server.rb:357:in
 `server_main_loop'
    
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server.rb:206:in
 `start_synchronously'
    
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server.rb:180:in
 `start'
    
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/rack/application_spawner.rb:129:in
 `start'
    
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/spawn_manager.rb:253:in
 `spawn_rack_application'
    
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server_collection.rb:132:in
 `lookup_or_add'
    
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/spawn_manager.rb:246:in
 `spawn_rack_application'
    
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server_collection.rb:82:in
 `synchronize'
    
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server_collection.rb:79:in
 `synchronize'
    
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/spawn_manager.rb:244:in
 `spawn_rack_application'
    
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/spawn_manager.rb:137:in
 `spawn_application'
    
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/spawn_manager.rb:275:in
 `handle_spawn_application'
    
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server.rb:357:in
 `__send__'
    
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server.rb:357:in
 `server_main_loop'
    
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server.rb:206:in
 `start_synchronously'
    
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/helper-scripts/passenger-spawn-server:99
</pre>

I tried to catch the resource that is being evaluated in 
/usr/lib/ruby/site_ruby/1.8/puppet/resource/type.rb before it fails and it has 
always been Class[main].

It looks like it starts failing after various nodes have asked for their 
catalog and hence many different modules have been loaded.

With the help from #puppet-dev I started debugging this issue. People from 
there will add more information.

I give it a high priority as this is something that worked on 3.1.1 and fails 
heavily on 3.2.2 so 3.2.2 is currently not useable for me, but it's the only 
version with the latest security fix for 3.x.


-- 
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