Jira (PUP-8002) "Attempt to redefine entity" caused by using a resource collector

21 views
Skip to first unread message

Ben Ford (JIRA)

unread,
Sep 28, 2017, 1:00:06 PM9/28/17
to puppe...@googlegroups.com
Ben Ford created an issue
 
Puppet / Bug PUP-8002
"Attempt to redefine entity" caused by using a resource collector
Issue Type: Bug Bug
Affects Versions: PUP 4.10.4
Assignee: Unassigned
Created: 2017/09/28 9:59 AM
Priority: Major Major
Reporter: Ben Ford

See

PUP-7650 for the root cause of the issue. This behaviour is also sometimes (indeterminately) cause by using a resource collector, and that does not seem to be corrected by the patch linked in PUP-7650 .

The error thrown is:

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Virtual Query, Could not autoload puppet/type/pe_ini_setting: Attempt to redefine entity 'http://puppet.com/2016.1/runtime/type/pe_ini_setting'. Set at unknown location at /etc/puppetlabs/code/modules/classroom/manifests/master/student_environment.pp:51:3 on node superdog.puppetlabs.vm

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v6.4.14#64029-sha1:ae256fe)
Atlassian logo

Geoff Nichols (JIRA)

unread,
Sep 28, 2017, 1:31:02 PM9/28/17
to puppe...@googlegroups.com

Geoff Nichols (JIRA)

unread,
Sep 28, 2017, 1:33:02 PM9/28/17
to puppe...@googlegroups.com
Geoff Nichols commented on Bug PUP-8002
 
Re: "Attempt to redefine entity" caused by using a resource collector

Thomas Hallgren, when you have a chance, could you please take a look?

Thomas Hallgren (JIRA)

unread,
Sep 28, 2017, 4:22:02 PM9/28/17
to puppe...@googlegroups.com

Ben Ford, please run the puppetserver with log-level trace and then extract the stack trace from servers puppetserver.log after the error occurs and paste it into this ticket. Without that, or clear steps to reproduce, there's not much I can do.

Thomas Hallgren (JIRA)

unread,
Oct 2, 2017, 7:02:02 AM10/2/17
to puppe...@googlegroups.com

I think this might be the same problem as in PE-22152 where the user provided I got a stacktrace using from a puppet lookup --compile. The resource collector query is resolved using PuppetDB which in turn creates a parser resource. Creating parser resources is bad in combination with puppet generate types. If the collector is the first to resolve the type, and that resolution is done through PuppetDB, then this error will happen everytime.

Thomas Hallgren (JIRA)

unread,
Oct 2, 2017, 7:11:02 AM10/2/17
to puppe...@googlegroups.com

Nicky Kernohan (JIRA)

unread,
Oct 2, 2017, 7:35:02 AM10/2/17
to puppe...@googlegroups.com
Nicky Kernohan updated an issue
Change By: Nicky Kernohan
CS Priority: Major
CS Severity: 3 - Serious
CS Frequency: 1 - 1-5% of Customers

Thomas Hallgren (JIRA)

unread,
Oct 2, 2017, 8:23:03 AM10/2/17
to puppe...@googlegroups.com
 
Re: "Attempt to redefine entity" caused by using a resource collector

Ben Ford, do you have an environment where this can be reproduced? I'm not able to, but I think I might have a fix.

Thomas Hallgren (JIRA)

unread,
Oct 5, 2017, 5:14:03 AM10/5/17
to puppe...@googlegroups.com

Owen Rodabaugh (JIRA)

unread,
Feb 8, 2018, 7:49:03 PM2/8/18
to puppe...@googlegroups.com
Owen Rodabaugh assigned an issue to Thomas Hallgren
Change By: Owen Rodabaugh
Assignee: Ben Ford Thomas Hallgren
This message was sent by Atlassian JIRA (v7.5.1#75006-sha1:7df2574)
Atlassian logo

Erik Hansen (JIRA)

unread,
Feb 8, 2018, 11:17:03 PM2/8/18
to puppe...@googlegroups.com
Erik Hansen commented on Bug PUP-8002
 
Re: "Attempt to redefine entity" caused by using a resource collector

Owen Rodabaugh - Yes, I believe it was merged here: https://github.com/puppetlabs/puppetdb/pull/2389

Although, there's still an open ticket for that issue with a status "ready for merge": https://tickets.puppetlabs.com/browse/PDB-3734

Thomas Hallgren (JIRA)

unread,
Feb 9, 2018, 5:21:02 AM2/9/18
to puppe...@googlegroups.com
Thomas Hallgren assigned an issue to Unassigned
 
Change By: Thomas Hallgren
Assignee: Thomas Hallgren

Ben Ford (JIRA)

unread,
Feb 9, 2018, 3:02:05 PM2/9/18
to puppe...@googlegroups.com
Ben Ford commented on Bug PUP-8002
 
Re: "Attempt to redefine entity" caused by using a resource collector

I have a customer hitting this error regularly now. Thomas Hallgren is this fixed? Did it get released?

Andrew Ball (JIRA)

unread,
Feb 9, 2018, 3:49:02 PM2/9/18
to puppe...@googlegroups.com
Andrew Ball commented on Bug PUP-8002

Yes, I can confirm I hit this intermittently but regularly. It seems that after our master does its own run, the problem resolves itself for a while. I was hoping to grab a trace to give more info, but the issue's gone for now. I'll grab one as soon as it fails again.

Thomas Hallgren (JIRA)

unread,
Feb 9, 2018, 4:52:03 PM2/9/18
to puppe...@googlegroups.com

Ben Ford, I have no explicit knowledge besides what the ticket shows of what's included in the releases that the customer is using. AFAIK, the issue is fixed by the PR that I've submitted. The fact that the ticket PDB-3734 is still in "ready for merge" is alarming but probably an oversight. The associated PR was merge a long time ago.

Andrew Ball (JIRA)

unread,
Jul 30, 2018, 1:00:02 PM7/30/18
to puppe...@googlegroups.com
Andrew Ball commented on Bug PUP-8002

Just to add to this ticket, I'm not sure the merged fix mentioned resolved this problem. I'm still seeing it in the case of a resource collector I'm using, and we've just upgraded to 2018.1.2

This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93)
Atlassian logo

Andrew Ball (JIRA)

unread,
Jul 30, 2018, 3:37:03 PM7/30/18
to puppe...@googlegroups.com
Andrew Ball commented on Bug PUP-8002

Further to this, the logs on our master show the following:

2018-07-30T13:30:44.466-06:00 ERROR [qtp477573777-322] [puppetserver] Puppet Could not autoload puppet/type/sqlserver_instance: Attempt to redefine entity 'http://puppet.com/2016.1/runtime/type/sqlserver_instance'. Set at unknown location /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/loader/base_loader.rb:123:in

`fail_redefine'

/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/loader/base_loader.rb:73:in

`set_entry'

/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/loaders.rb:151:in

`register_runtime3_type'

/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/metatype/manager.rb:134:in

`newtype'

/etc/puppetlabs/code/environments/test/modules/sqlserver/lib/puppet/type/sqlserver_instance.rb:4:in

`<main>'

org/jruby/RubyKernel.java:974:in `load'

/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/autoload.rb:68:in

`load_file'

/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/autoload.rb:194:in

`load'

/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/metatype/manager.rb:174:in

`type'

/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/resource.rb:360:in

`resource_type'

/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/resource.rb:348:in

`resource_type'

/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/resource.rb:289:in

`initialize'

/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/parser/resource.rb:127:in

`initialize'

/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/evaluator/collectors/abstract_collector.rb:54:in

`block in evaluate'

org/jruby/RubyArray.java:1735:in `each'

/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/evaluator/collectors/abstract_collector.rb:52:in

`evaluate'

/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/parser/compiler.rb:525:in

`block in evaluate_collections'

org/jruby/RubyArray.java:1735:in `each'

/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/parser/compiler.rb:524:in

`block in evaluate_collections'

/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/profiler/around_profiler.rb:58:in

`profile'

/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/profiler.rb:51:in

`profile'

/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/parser/compiler.rb:522:in

`block in evaluate_collections'

/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/errors.rb:115:in

`exceptwrap'

/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/parser/compiler.rb:518:in

`evaluate_collections'

/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/parser/compiler.rb:568:in

`block in evaluate_generators'

/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/profiler/around_profiler.rb:58:in

`profile'

/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/profiler.rb:51:in

`profile'

/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/parser/compiler.rb:566:in

`block in evaluate_generators'

org/jruby/RubyKernel.java:1316:in `loop'

/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/parser/compiler.rb:563:in

`evaluate_generators'

/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/parser/compiler.rb:179:in

`block in compile'

/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/profiler/around_profiler.rb:58:in

`profile'

/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/profiler.rb:51:in

`profile'

/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/parser/compiler.rb:179:in

`block in compile'

/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/context.rb:65:in

`override'

/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet.rb:260:in `override'

/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/parser/compiler.rb:155:in

`compile'

/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/parser/compiler.rb:35:in

`compile'

/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/indirector/catalog/compiler.rb:305:in

`block in compile'

/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/profiler/around_profiler.rb:58:in

`profile'

/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/profiler.rb:51:in

`profile'

/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/indirector/catalog/compiler.rb:303:in

`block in compile'

/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:232:in `block in benchmark'

uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/benchmark.rb:308:in

`realtime'

/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:231:in

`benchmark'

/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/indirector/catalog/compiler.rb:301:in

`compile'

/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/indirector/catalog/compiler.rb:54:in

`find'

/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/indirector/indirection.rb:198:in

`find'

/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/network/http/api/indirected_routes.rb:121:in

`do_find'

/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/network/http/api/indirected_routes.rb:48:in

`block in call'

/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/context.rb:65:in

`override'

/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet.rb:260:in `override'

/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/network/http/api/indirected_routes.rb:47:in

`call'

/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/network/http/route.rb:82:in

`block in process'

org/jruby/RubyArray.java:1735:in `each'

/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/network/http/route.rb:81:in

`process'

/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/network/http/route.rb:87:in

`process'

/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/network/http/route.rb:87:in

`process'

/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/network/http/handler.rb:64:in

`block in process'

/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/profiler/around_profiler.rb:58:in

`profile'

/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/profiler.rb:51:in

`profile'

/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/network/http/handler.rb:62:in

`process'

uri:classloader:/puppetserver-lib/puppet/server/master.rb:42:in

`handleRequest'

 

Steve Quin (JIRA)

unread,
Oct 4, 2018, 10:23:06 AM10/4/18
to puppe...@googlegroups.com
Steve Quin commented on Bug PUP-8002

Eric Sorenson  cc Neil Binney

Is this something we can add to the Puppets backlog?

 

Thanks, Steve

Eric Sorenson (JIRA)

unread,
Oct 4, 2018, 12:47:06 PM10/4/18
to puppe...@googlegroups.com
Eric Sorenson commented on Bug PUP-8002

Thomas Hallgren when you say "this needs to happen"... does that mean the change you linked to needs to go into additional places? since that PR seems to be merged and released.

Henrik Lindberg (JIRA)

unread,
Oct 4, 2018, 1:23:36 PM10/4/18
to puppe...@googlegroups.com

It (PR 2389 to PDB) had not been merged when Thomas made the comment from what I can tell.
Looking at the code, there are no changes made in the collector - it just relies on the Resource being created to load its type - and it seems to go to the autoloader - then it probably ends up recursing while loading a previously not loaded type and ends up biting itself in the a**.

Sean Millichamp (JIRA)

unread,
Oct 12, 2018, 5:07:06 PM10/12/18
to puppe...@googlegroups.com

Sean Millichamp (JIRA)

unread,
Oct 12, 2018, 5:08:07 PM10/12/18
to puppe...@googlegroups.com

Eric Sorenson (JIRA)

unread,
Oct 12, 2018, 6:10:28 PM10/12/18
to puppe...@googlegroups.com
Eric Sorenson commented on Bug PUP-8002

Spent some time with Sean Millichamp digging through this - some more details

  • The error happens sporadically and only compiling on sles, which has a collector for inifile resources

    Ini_setting <| title == 'zypper pc_repo autorefresh' |> { value => '1' }
    

  • the error always implicates inifile, and there's never an 'origin' in the message, as might happen from lib/puppet/pops/loaders/base_loader.rb:123:

     
      def fail_redefine(entry)
        origin_info = entry.origin ? _("Originally set %{original}.") % { original: origin_label(entry.origin) } : _("Set at unknown location")
        raise ArgumentError, _("Attempt to redefine entity '%{name}'. %{origin_info}") % { name: entry.typed_name, origin_info: origin_info }
      end
    

  • it's using inifile 2.2.2 - the generated type definition for this type doesn't have any obvious wackiness (no composite namevars, procs in :name, etc)

Since this was a new problem that came in after an upgrade, I'm suggesting turning off the generation of type descriptions, scrubbing the cache, and letting the autoloader fall back to the previous behaviour of loading the ruby types directly.

The hiera key puppet_enterprise::master::puppetserver::pre_commit_hook_commands: [] should turn off the hook, then rm /etc/puppetlabs/code/environments/*/.resource_types, service restart...

Eric Sorenson (JIRA)

unread,
Oct 12, 2018, 7:55:03 PM10/12/18
to puppe...@googlegroups.com
Eric Sorenson commented on Bug PUP-8002

I put up https://github.com/puppetlabs/puppet/pull/7162 which might address this? Would love to see if someone with the problem can try it out....

Sean Millichamp (JIRA)

unread,
Oct 13, 2018, 11:12:07 AM10/13/18
to puppe...@googlegroups.com

Eric Sorenson I tried your patch in the above PR on a single compile master and I went from a consistent average of around 10 "Puppet Could not autoload" error messages per hour to zero over the last 90 minutes it was running. I think it is a safe bet to say that your patch has fixed the issue.

Now, what is the chance we could get that also backported into Puppet 5.x for an upcoming LTS PE release?

Thank you!

Henrik Lindberg (JIRA)

unread,
Oct 18, 2018, 5:49:08 PM10/18/18
to puppe...@googlegroups.com

Eric Sorenson (JIRA)

unread,
Nov 15, 2018, 5:49:04 PM11/15/18
to puppe...@googlegroups.com
Eric Sorenson commented on Bug PUP-8002
 
Re: "Attempt to redefine entity" caused by using a resource collector

Henrik Lindberg could you please pull this back to the 5.5.x series as well? it should have been slated for that in the first place since that's the customer request.

Henrik Lindberg (JIRA)

unread,
Nov 16, 2018, 5:47:03 AM11/16/18
to puppe...@googlegroups.com

Henrik Lindberg (JIRA)

unread,
Nov 16, 2018, 6:03:04 AM11/16/18
to puppe...@googlegroups.com
Henrik Lindberg updated an issue
Change By: Henrik Lindberg
Release Notes Summary: Under some conditions the error "Attempt to redefine entity" would be raised when compiling a catalog. This was caused by having missed one place out of many where logic needed an update to newer internal APIs.
Release Notes: Bug Fix

Henrik Lindberg (JIRA)

unread,
Nov 16, 2018, 6:05:03 AM11/16/18
to puppe...@googlegroups.com
 
Re: "Attempt to redefine entity" caused by using a resource collector

If 5.5.9 is released before PUP 6.1.0, then PUP-9317 would have been release noted already.

Josh Cooper (JIRA)

unread,
Nov 20, 2018, 12:56:08 PM11/20/18
to puppe...@googlegroups.com
Josh Cooper updated an issue
 
Change By: Josh Cooper
Fix Version/s: PUP 6.0.5
Fix Version/s: PUP 5.5.9

Josh Cooper (JIRA)

unread,
Nov 20, 2018, 12:57:05 PM11/20/18
to puppe...@googlegroups.com

Jean Bond (JIRA)

unread,
Dec 10, 2018, 7:38:04 PM12/10/18
to puppe...@googlegroups.com
Jean Bond updated an issue
 
Change By: Jean Bond
Release Notes Summary: When compiling a catalog, Puppet sometimes raised the error "Attempt to redefine entity." Under some conditions the error "Attempt to redefine entity" would be raised when compiling a catalog. This was caused by having missed one place out of many where logic needed an update to newer internal APIs.

Jean Bond (JIRA)

unread,
Dec 10, 2018, 7:48:03 PM12/10/18
to puppe...@googlegroups.com
Jean Bond updated an issue
Change By: Jean Bond
Release Notes Summary: When compiling a catalog, Puppet sometimes raised the error "Attempt to redefine entity." Under some conditions the error "Attempt to redefine entity" would be raised when compiling a catalog. This was caused by having missed one place out of many where logic needed issue has been fixed with an update to newer the internal APIs logic .

Jean Bond (JIRA)

unread,
Dec 17, 2018, 2:16:03 PM12/17/18
to puppe...@googlegroups.com

Kenn Hussey (JIRA)

unread,
Dec 19, 2018, 3:59:05 PM12/19/18
to puppe...@googlegroups.com
Kenn Hussey commented on Bug PUP-8002
 
Re: "Attempt to redefine entity" caused by using a resource collector

Sean McDonald did this come up in ticket reconciliation for 6.1? Can it be resolved at this point?

Sean McDonald (JIRA)

unread,
Dec 19, 2018, 4:25:08 PM12/19/18
to puppe...@googlegroups.com

Austin Boyd (JIRA)

unread,
Dec 12, 2019, 8:29:05 AM12/12/19
to puppe...@googlegroups.com
Austin Boyd updated an issue
 
Change By: Austin Boyd
Zendesk Ticket IDs: 35324
Zendesk Ticket Count: 1
Reply all
Reply to author
Forward
0 new messages