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

Ruby stacktraces no longer interleave Puppet Code stacktraces

    XMLWordPrintable

Details

    • Froyo
    • Needs Assessment
    • Bug Fix
    • Hide
      This release fixes a bug where stacktraces from errors no longer had the Ruby stack frames interleaved with the Puppet stack frames when using `trace`.

      This release also introduces a new setting, `puppet_trace`, which prints the Puppet stack without the Ruby frames interleaved. If the `trace` setting is enabled, it overrides the value of `puppet_trace`.
      Show
      This release fixes a bug where stacktraces from errors no longer had the Ruby stack frames interleaved with the Puppet stack frames when using `trace`. This release also introduces a new setting, `puppet_trace`, which prints the Puppet stack without the Ruby frames interleaved. If the `trace` setting is enabled, it overrides the value of `puppet_trace`.
    • Needs Assessment

    Description

      Puppet Version: 6.11.1
      Puppet Server Version: N/A
      OS Name/Version: Windows 10

      As part of https://github.com/puppetlabs/puppet/pull/7754 the Puppet Stack Trace feature was modified to use an independent stack trace storing mechanism, however this may have introduced an unforseen behaviour change.

      Previously users would be able to trace how Puppet has traversed the invocations within a Manifest file. For example int the given manifest

      class nest1 {
        fail('somethinng')
      }
       
      class nest2 {
        include nest1
      }
       
      include nest2
      

      Previously in Puppet 6.10.1, we can see a puppet apply <manifest> --trace gives

      Error: Evaluation Error: Error while evaluating a Function Call, somethinng (file: C:/Source/puppet/tmp/test.pp, line: 2, column: 3) on node glenn.sarti-r90qu2hx
      C:/Source/puppet/lib/puppet/parser/functions/fail.rb:10:in `block in get_binding'
      C:/Source/puppet/lib/puppet/parser/functions.rb:206:in `block (2 levels) in newfunction'
      ...
      C:/Source/puppet/tmp/test.pp:2:in `block in call_function'
      ...
      C:/Source/puppet/tmp/test.pp:6:in `block in call_function'
      ...
      C:/Source/puppet/tmp/test.pp:9:in `block in call_function'
      ...
      C:/Source/puppet/tmp/test.pp:in `stack'
      ...
      

      We can see the various includes and Puppet call stack.

      However in Puppet 6.11.1 we get:

      ...
      Error: Evaluation Error: Error while evaluating a Function Call, somethinng (file: C:/Source/puppet/tmp/test.pp, line: 2, column: 3) on node glenn.sarti-r90qu2hx
      

      And that's it. The call stack within Puppet is no longer available. Now, that's probably due to Puppet no longer using the Ruby stack to store the information, however...

      Due to the way the stack is implemented, the stack is cleared (via the `shift` in https://github.com/puppetlabs/puppet/blob/1356f58d66/lib/puppet/pops/puppet_stack.rb#L44-L46) BEFORE any error trapping can occur.

      Effectively, the Puppet Stack is no longer available during exceptions, only the exception location, which seems a concerning.

      Attachments

        Issue Links

          Activity

            People

              justin Justin Stoller
              glenn.sarti Glenn Sarti
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Zendesk Support