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

PuppetStack.stacktrace is slow with a large stack

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: PUP 5.5.1, PUP 6.0.0
    • Component/s: None
    • Labels:
      None
    • Template:
      PUP Bug Template
    • Sub-team:
    • Team:
      Platform Core
    • Sprint:
      Platform Core KANBAN
    • Method Found:
      Needs Assessment
    • Release Notes:
      Not Needed
    • Release Notes Summary:
      optimization
    • QA Risk Assessment:
      No Action

      Description

      Several places in Puppet call PuppetStack.stacktrace[0] to get their "caller". Most notably, log messages where the "source" is a Scope object without an associated resource use that method to determine the "source" to log from. There are also some Puppet functions that use it (empty, create_resource, and more).

      Those calls become quite slow (I saw up to 50ms) when the stack is large. While it's probably uncommon for the stack to grow that deep, no caller currently uses anything but the top element of the stack, which means this is a straightforward opportunity for improvement.

      It probably makes sense to either make that method lazy, which is a bit of a challenge as it's both a filter and a map, or to add a method that specifically returns the top element of the stack, which satisfies every current caller.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              nick Nick Lewis
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Zendesk Support