[PUP-2587] circular inheritance causes stack too deep error Created: 2014/05/16  Updated: 2020/01/23

Status: Accepted
Project: Puppet
Component/s: Language
Affects Version/s: PUP 3.8.2, PUP 4.2.1
Fix Version/s: None

Type: Bug Priority: Normal
Reporter: Henrik Lindberg Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Epic Link: 5.y Validation
Team: Froyo
QA Contact: Kurt Wall


if a node or a class inherits in such a way that the result is circular, the result is a "stack too deep" error without any additional information.

This is caused by by "instantiate_resource" because it does not check if it is already processing a parent entity.

class foo inherits foo { }

This occurs in both 3x parser and in future parser.

This can not be statically validated.

Comment by Josh Cooper [ 2020/01/23 ]

This is no longer reproducible using 6.12.0:

[root@softer-dearth ~]# cat /etc/puppetlabs/code/environments/production/manifests/site.pp
class foo inherits foo { }
[root@softer-dearth ~]# puppet agent -t
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Retrieving locales
Info: Caching catalog for softer-dearth.delivery.puppetlabs.net
Info: Applying configuration version '1579807952'
Notice: Applied catalog in 0.01 seconds

Comment by Henrik Lindberg [ 2020/01/23 ]

If it did not error out then that is a problem. Maybe combine fixing that with the ticket about validating that a class does not require itself.

Comment by Josh Cooper [ 2020/01/23 ]

Dang.. yeah it's still a problem. I think the code was ignored due to the class not being included. Given:

[root@softer-dearth ~]# cat /etc/puppetlabs/code/environments/production/manifests/site.pp
include foo
[root@softer-dearth ~]# cat /etc/puppetlabs/code/environments/production/modules/foo/manifests/init.pp
class foo inherits foo { }

An agent run cause the server to stackoverflow.

2020-01-24T01:00:11.128Z WARN  [qtp1400473817-35] [o.e.j.s.HttpChannel] /puppet/v3/catalog/softer-dearth.delivery.puppetlabs.net2020-01-24T01:00:11.128Z WARN  [qtp1400473817-35] [o.e.j.s.HttpChannel] /puppet/v3/catalog/softer-dearth.delivery.puppetlabs.netjava.lang.StackOverflowError: null at opt.puppetlabs.puppet.lib.ruby.vendor_ruby.puppet.resource.invokeOther12:known_resource_types(/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/resource.rb:378) at opt.puppetlabs.puppet.lib.ruby.vendor_ruby.puppet.resource.RUBY$method$resource_type$0(/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/resource.rb:378) at org.jruby.internal.runtime.methods.CompiledIRMethod.call(CompiledIRMethod.java:143) at org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:221) at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:216) at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:234) 

Generated at Tue Jul 14 01:54:02 PDT 2020 using Jira 8.5.2#805002-sha1:a66f9354b9e12ac788984e5d84669c903a370049.