Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-10029

A Puppet::DataTypes::Error#to_s() fails with a stack overflow

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Accepted
    • Priority: Normal
    • Resolution: Unresolved
    • Affects Version/s: PUP 6.10.0
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Template:
      PUP Bug Template
    • Team:
      Bolt
    • Method Found:
      Needs Assessment
    • QA Risk Assessment:
      Needs Assessment

      Description

      Puppet Version: 6.10 (master)

      Instances of Puppet::DataTypes::Error end up recursively overflowing the stack calling to_s().

      [root@wuh7cxdfusfnult installer]# /opt/puppetlabs/puppet/bin/puppet --version
      6.10.0
      [root@wuh7cxdfusfnult installer]# /opt/puppetlabs/puppet/bin/irb
      irb(main):001:0> require 'puppet'
      r=> true
      irb(main):002:0> require 'puppet/datatypes/impl/error'
      => true
      irb(main):003:0> e = Puppet::DataTypes::Error.new('foo')
      => #<Puppet::DataTypes::Error:0x00000000024d9c50 @msg="foo", @kind=nil, @details=nil, @issue_code=nil>
      irb(main):004:0> e.to_s
      Traceback (most recent call last):
             16: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/types/string_converter.rb:602:in `string_PRuntimeType'
             15: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/datatypes/impl/error.rb:38:in `to_s'
             14: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/types/string_converter.rb:485:in `convert'
             13: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/types/type_calculator.rb:130:in `infer_set'
             12: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/types/type_calculator.rb:272:in `infer_set'
             11: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/types/type_calculator.rb:253:in `infer'
             10: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/visitor.rb:83:in `visit_this_0'
              9: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/types/type_calculator.rb:519:in `infer_Object'
              8: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/types/type_calculator.rb:519:in `new'
              7: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/types/p_runtime_type.rb:33:in `initialize'
              6: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/types/type_asserter.rb:33:in `assert_instance_of'
              5: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/types/types.rb:2991:in `instance?'
              4: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/types/types.rb:2991:in `any?'
              3: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/types/types.rb:2991:in `block in instance?'
              2: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/types/types.rb:1551:in `instance?'
              1: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/types/types.rb:1027:in `instance?'
      SystemStackError (stack level too deep)
      irb(main):005:0> 
      

      This turned up while I was working with Bolt apply(), and had captured an error before calling a new apply(). The Bolt Applicator transforms a catalog_input Hash to JSON here. Part of that input hash are existing variables in the plan. If one of those variables is a stored error from a previous apply, for example, it fails here when to_json calls to_s on it...

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              joshua.partlow Joshua Partlow
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:

                  Zendesk Support