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

segfault with augeas type when changes attribute is too long

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: PUP 4.2.1
    • Fix Version/s: PUP 5.0.0
    • Component/s: Types and Providers
    • Environment:
    • Template:
    • Team:
      Agent
    • Story Points:
      0
    • Sprint:
      Agent 2017-06-14
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      Incorrectly prepared augeas resources crashed Puppet agent with a segfault and caused it to hang. The augeas component was updated from 1.4.0 to 1.8.0 to resolve this issue.
    • QA Risk Assessment:
      No Action
    • QA Risk Assessment Reason:
      real problem fixed and tested in Augeas code

      Description

      Overview

      An incorrectly prepared augeas resource crashes puppet agent with a segfault and causes it to hang

      Expected result

      Incorrectly prepared augeas resources should fail quickly with an error, they should never result in a segfault

      Actual result

      [master]root@geoff:~/puppetcode/modules/kerberos/tests # puppet apply init.pp 
      Notice: Compiled catalog for geoff.puppetlabs.vm in environment production in 0.31 seconds
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/provider/augeas/augeas.rb:385: [BUG] Segmentation fault at 0x2020202c
      ruby 2.1.6p336 (2015-04-13 revision 50298) [i686-linux]
       
      -- Control frame information -----------------------------------------------
      c:0046 p:---- s:0238 e:000237 CFUNC  :save
      c:0045 p:0182 s:0235 e:000234 METHOD /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/provider/augeas/augeas.rb:385
      c:0044 p:0011 s:0223 e:000222 METHOD /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/type/augeas.rb:190
      c:0043 p:0056 s:0220 e:000216 BLOCK  /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/type.rb:1053 [FINISH]
      c:0042 p:---- s:0214 e:000213 CFUNC  :each
      c:0041 p:0157 s:0211 e:000210 METHOD /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/type.rb:1048
      c:0040 p:0007 s:0205 e:000204 METHOD /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/type.rb:1071
      c:0039 p:0017 s:0201 e:000198 METHOD /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction/resource_harness.rb:241
      c:0038 p:0038 s:0194 e:000193 METHOD /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction/resource_harness.rb:19
      c:0037 p:0014 s:0187 e:000186 METHOD /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction.rb:204
      c:0036 p:0077 s:0180 e:000179 METHOD /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction.rb:220 [FINISH]
      c:0035 p:---- s:0175 e:000174 CFUNC  :call
      c:0034 p:0011 s:0171 e:000170 BLOCK  /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction.rb:147
      c:0033 p:0006 s:0169 e:000168 BLOCK  /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:292
      c:0032 p:0019 s:0167 e:000166 METHOD /opt/puppetlabs/puppet/lib/ruby/2.1.0/benchmark.rb:294
      c:0031 p:0013 s:0163 e:000162 METHOD /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:291
      c:0030 p:0070 s:0159 e:000158 BLOCK  /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction.rb:147
      c:0029 p:0146 s:0155 e:000154 METHOD /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/graph/relationship_graph.rb:118
      c:0028 p:0175 s:0142 E:001868 METHOD /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction.rb:138
      c:0027 p:0008 s:0130 e:000129 BLOCK  /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:178
      c:0026 p:0017 s:0128 e:000127 METHOD /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/log.rb:153
      c:0025 p:0020 s:0123 e:000122 METHOD /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction/report.rb:107
      c:0024 p:0046 s:0119 E:0025cc METHOD /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:177
      c:0023 p:0010 s:0114 e:000113 BLOCK  /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/configurer.rb:119
      c:0022 p:0006 s:0112 e:000111 BLOCK  /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:129
      c:0021 p:0019 s:0110 e:000109 METHOD /opt/puppetlabs/puppet/lib/ruby/2.1.0/benchmark.rb:294
      c:0020 p:0168 s:0106 e:000105 METHOD /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:128
      c:0019 p:0034 s:0098 e:000097 METHOD /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/configurer.rb:118
      c:0018 p:1001 s:0092 e:000091 METHOD /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/configurer.rb:228
      c:0017 p:0009 s:0080 e:000079 BLOCK  /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/configurer.rb:134
      c:0016 p:0047 s:0078 e:000077 METHOD /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/context.rb:64
      c:0015 p:0019 s:0071 e:000070 METHOD /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet.rb:223
      c:0014 p:0055 s:0065 E:00012c METHOD /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/configurer.rb:133
      c:0013 p:0033 s:0060 e:000059 METHOD /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application/apply.rb:343
      c:0012 p:0260 s:0055 e:000054 BLOCK  /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application/apply.rb:274
      c:0011 p:0047 s:0048 e:000047 METHOD /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/context.rb:64
      c:0010 p:0019 s:0041 e:000040 METHOD /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet.rb:223
      c:0009 p:0391 s:0035 E:0016f8 METHOD /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application/apply.rb:225
      c:0008 p:0025 s:0027 e:000026 METHOD /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application/apply.rb:170
      c:0007 p:0007 s:0024 e:000023 BLOCK  /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application.rb:344
      c:0006 p:0009 s:0022 e:000021 METHOD /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:446
      c:0005 p:0090 s:0016 e:000015 METHOD /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application.rb:344
      c:0004 p:0103 s:0013 E:001f94 METHOD /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/command_line.rb:128
      c:0003 p:0042 s:0008 e:000007 METHOD /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/command_line.rb:72
      c:0002 p:0027 s:0005 E:001b28 EVAL   /usr/local/bin/puppet:5 [FINISH]
      c:0001 p:0000 s:0002 E:001f74 TOP    [FINISH]
       
      /usr/local/bin/puppet:5:in `<main>'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/command_line.rb:72:in `execute'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/command_line.rb:128:in `run'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application.rb:344:in `run'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:446:in `exit_on_fail'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application.rb:344:in `block in run'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application/apply.rb:170:in `run_command'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application/apply.rb:225:in `main'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet.rb:223:in `override'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/context.rb:64:in `override'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application/apply.rb:274:in `block in main'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application/apply.rb:343:in `apply_catalog'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/configurer.rb:133:in `run'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet.rb:223:in `override'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/context.rb:64:in `override'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/configurer.rb:134:in `block in run'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/configurer.rb:228:in `run_internal'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/configurer.rb:118:in `apply_catalog'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:128:in `benchmark'
      /opt/puppetlabs/puppet/lib/ruby/2.1.0/benchmark.rb:294:in `realtime'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:129:in `block in benchmark'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/configurer.rb:119:in `block in apply_catalog'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:177:in `apply'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction/report.rb:107:in `as_logging_destination'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/log.rb:153:in `with_destination'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:178:in `block in apply'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction.rb:138:in `evaluate'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/graph/relationship_graph.rb:118:in `traverse'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction.rb:147:in `block in evaluate'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:291:in `thinmark'
      /opt/puppetlabs/puppet/lib/ruby/2.1.0/benchmark.rb:294:in `realtime'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:292:in `block in thinmark'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction.rb:147:in `block (2 levels) in evaluate'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction.rb:147:in `call'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction.rb:220:in `eval_resource'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction.rb:204:in `apply'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction/resource_harness.rb:19:in `evaluate'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction/resource_harness.rb:241:in `from_resource'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/type.rb:1071:in `retrieve_resource'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/type.rb:1048:in `retrieve'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/type.rb:1048:in `each'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/type.rb:1053:in `block in retrieve'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/type/augeas.rb:190:in `retrieve'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/provider/augeas/augeas.rb:385:in `need_to_run?'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/provider/augeas/augeas.rb:385:in `save'
       
      -- C level backtrace information -------------------------------------------
      

      Screen freezes here and puppet cannot be terminated with ctrl+c, it has to be backgrounded and killed

      Example resource

      The following resource causes the problem:

        augeas { "krb5.config":
          changes => [
            "set /files/etc/krb5.conf/libdefaults/realms/default_realm PUPPETLABS.VM",
          ],
        }
      

      If the resource is reformatted correctly:

         augeas { 'krb5.conf':
           context => '/files/etc/krb5.conf/libdefaults',
           changes => 'set default_realm PUPPETLABS.VM',
         }
      

      Then puppet works without issue.

      Testcase

      Please see attached tarball for a testcase. The error can be reproduced with 100% repeatability by running puppet apply kerberos/tests/init.pp

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              jorie Jorie Tappa
              Reporter:
              geoff.williams Geoff Williams
              QA Contact:
              Eric Thompson
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Zendesk Support