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

referencing non-existant variable in custom function crashes puppetserver

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: PUP 4.8.0
    • Component/s: None
    • Labels:
    • Template:
    • Master Config:
      Monolithic
    • Agent OS:
      RHEL 7 (x86_64)
    • Master OS:
      RHEL 7 (x86_64)
    • Team:
      Next Generation
    • Story Points:
      5
    • Sprint:
      NG 2016-10-05, NG 2016-10-19
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      Hide
      Puppet extensions with Ruby errors (specifically noted in custom functions that referenced undefined local variables) would cause Puppet to create an error message that contained most of the Ruby object space. This message could be gigabytes in size and under load would cause the Puppet Server process to die with an OutOfMemoryError. Now failure to load a Puppet extension will create a reasonably short error string that will *not* use gigabytes of memory.
      Show
      Puppet extensions with Ruby errors (specifically noted in custom functions that referenced undefined local variables) would cause Puppet to create an error message that contained most of the Ruby object space. This message could be gigabytes in size and under load would cause the Puppet Server process to die with an OutOfMemoryError. Now failure to load a Puppet extension will create a reasonably short error string that will *not* use gigabytes of memory.

      Description

      Overview

      Using a function that references an undefined variable (ie by typo) in a function crashes puppetserver with an out of memory error

      Expected result

      Puppet should warn the user if an undefined variable is encountered. Ideally in the output of puppet agent -t

      Actual result

      Puppet runs take a long time and then fail with one of the following messages:

      Error: Could not retrieve catalog from remote server: end of file reached
      Warning: Not using cache on failed catalog
      Error: Could not retrieve catalog; skipping run
      Error: Could not send report: Connection refused - connect(2) for "puppet.demo.internal" port 8140
      

      or

      Error: Could not retrieve catalog from remote server: Error 500 on SERVER: <html>
      <head>
      <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
      <title>Error 500 </title>
      </head>
      <body>
      <h2>HTTP ERROR: 500</h2>
      <p>Problem accessing /puppet/v3/catalog/pe-puppet.localdomain. Reason:
      <pre>    Java heap space</pre></p>
      <hr /><i><small>Powered by Jetty://</small></i>
      </body>
      </html>
       
      Warning: Not using cache on failed catalog
      Error: Could not retrieve catalog; skipping run
      

      Also, please see attached puppetserver.log

      Steps to reproduce

      Testcase module

      /etc/puppetlabs/code/environments/production/modules/testcase/lib/puppet/functions/testfunc.rb

      Puppet::Functions.create_function(:testfunc) do
        def testfunc
          nothere
        end
      end
      

      Reference the function

      /etc/puppetlabs/code/environments/production/manifests/site.pp

      $uhoh=testfunc()
      

      Run puppet

      puppet agent -t
      

      Workaround

      Make sure you don't reference any undeclared variables

        Attachments

          Activity

            jsd-sla-details-panel

              People

              • Assignee:
                justin Justin Stoller
                Reporter:
                geoff.williams Geoff Williams
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: