Uploaded image for project: 'Facter'
  1. Facter
  2. FACT-1728

facter -p dies with an inscrutable error if puppet crashes

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: FACT 3.6.6
    • Fix Version/s: FACT 3.6.7, FACT 3.9.0
    • Component/s: None
    • Labels:
      None
    • Environment:

      windows 2012r2
      windows 2008

    • Template:
    • Team:
      Platform OS
    • Story Points:
      1
    • Sprint:
      Platform OS 2017-08-22
    • Method Found:
      Needs Assessment
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      Improve error message when `-p` is specified but Puppet cannot be loaded.
    • QA Risk Assessment:
      Manual

      Description

      If Puppet crashes during initialization, as reported in PUP-7821, then facter -p will also crash, but with a very cryptic error from the Boost library.

      Reproduction Case

      1. Install puppet-agent 4.10.5 on a Windows 2012R2 machine.

      2. Start a Powershell session and set an environment variable containing a non-UTF8 string:

      $ENV:BadValue = [char]0xdddd
      

      3. Run facter -p

      Outcome

      Facter crashes with a very terse error message:

      2017-08-08 22:51:26.364992 FATAL puppetlabs.facter - 
      unhandled exception: boost::too_many_args: format-string referred to less arguments than were passed
      

      Adding the --debug flag reveals a little more detail:

      facter : 2017-08-08 22:51:25.708722 INFO  puppetlabs.facter - executed with command line: -p --debug.
      At line:1 char:1
      + facter -p --debug 2>&1 | Out-File .\results.txt
      + ~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : NotSpecified: (2017-08-08 22:5...ne: -p --debug.:String) [], RemoteException
          + FullyQualifiedErrorId : NativeCommandError
       
      2017-08-08 22:51:25.724338 DEBUG leatherman.dynamic_library:62 - 
      no loaded libraries found matching pattern ^[^_]*ruby(\d)?(\d)?(\d)?\.dll$
       
      2017-08-08 22:51:25.724338 DEBUG leatherman.ruby:510 - 
      ruby was found at "C:\Program Files\Puppet Labs\Puppet\sys\ruby\bin\ruby.exe".
       
      2017-08-08 22:51:25.724338 DEBUG leatherman.execution:92 - 
      executing command: C:\Program Files\Puppet Labs\Puppet\sys\ruby\bin\ruby.exe -e print(['libdir', 'archlibdir', 
      'sitearchlibdir', 'bindir'].find do |name|dir = RbConfig::CONFIG[name];next unless dir;file = File.join(dir, 
      RbConfig::CONFIG['LIBRUBY_SO']);break file if File.exist? file;false end)
       
      2017-08-08 22:51:25.786786 DEBUG | - 
      C:/Program Files/Puppet Labs/Puppet/sys/ruby/bin/x64-msvcrt-ruby210.dll
       
      2017-08-08 22:51:25.786786 DEBUG leatherman.execution:688 - 
      process exited with exit code 0.
      2017-08-08 22:51:25.786786 INFO  leatherman.ruby:138 - ruby loaded from "C:/Program Files/Puppet 
      Labs/Puppet/sys/ruby/bin/x64-msvcrt-ruby210.dll".
       
      2017-08-08 22:51:25.849277 INFO  leatherman.ruby:187 - 
      using ruby version 2.1.9
      2017-08-08 22:51:25.849277 INFO  puppetlabs.facter - resolving all facts.
      2017-08-08 22:51:25.849277 DEBUG puppetlabs.facter - fact "facterversion" has resolved to "3.6.6".
      2017-08-08 22:51:25.849277 DEBUG puppetlabs.facter - fact "aio_agent_version" has resolved to "1.10.5".
      2017-08-08 22:51:25.849277 DEBUG leatherman.windows:42 - initializing WMI
       
      2017-08-08 22:51:25.849277 DEBUG puppetlabs.facter - 
      setting fact "env_windows_installdir" based on the value of environment variable "FACTER_env_windows_installdir".
       
       
      2017-08-08 22:51:25.849277 DEBUG puppetlabs.facter - 
      fact "env_windows_installdir" has resolved to "C:\Program Files\Puppet Labs\Puppet".
       
       
      2017-08-08 22:51:25.849277 DEBUG puppetlabs.facter - 
      initializing Winsock
       
       
      2017-08-08 22:51:25.849277 DEBUG leatherman.file_util:65 - 
      Error reading file: The system cannot find the path specified
       
       
      2017-08-08 22:51:26.364992 FATAL puppetlabs.facter - 
      unhandled exception: boost::too_many_args: format-string referred to less arguments than were passed
      

      Expected Outcome

      The error message should indicate that there was an issue loading Puppet:

      PS C:\Users\Administrator> puppet facts find
       
      puppet : C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/vendor_ruby/puppet/util/windows/api_types.rb:59:in 
      `encode': "\xDD\xDD" on UTF-16LE (Encoding::InvalidByteSequenceError)
      At line:1 char:1
      + puppet facts find 2>&1 | Out-File .\results.txt
      + ~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : NotSpecified: (C:/Program File...eSequenceError):String) [], RemoteException
          + FullyQualifiedErrorId : NativeCommandError
       
          from C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/vendor_ruby/puppet/util/windows/api_types.rb:59:in 
      `read_wide_string'
          from C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/vendor_ruby/puppet/util/windows/api_types.rb:76:in 
      `block in read_arbitrary_wide_string_up_to'
          from C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/vendor_ruby/puppet/util/windows/api_types.rb:75:in 
      `each'
          from C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/vendor_ruby/puppet/util/windows/api_types.rb:75:in 
      `read_arbitrary_wide_string_up_to'
          from C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/vendor_ruby/puppet/util/windows/process.rb:239:in 
      `get_environment_strings'
          from C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/vendor_ruby/puppet/util.rb:43:in `get_env'
          from C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/vendor_ruby/puppet/defaults.rb:273:in `block in 
      <module:Puppet>'
          from C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/vendor_ruby/puppet/settings.rb:923:in `block in 
      define_settings'
          from C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/vendor_ruby/puppet/settings.rb:922:in `each'
          from C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/vendor_ruby/puppet/settings.rb:922:in `define_settings'
          from C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/vendor_ruby/puppet.rb:140:in `define_settings'
          from C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/vendor_ruby/puppet/defaults.rb:152:in `<module:Puppet>'
          from C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/vendor_ruby/puppet/defaults.rb:1:in `<top (required)>'
          from C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in 
      `require'
          from C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in 
      `require'
          from C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/vendor_ruby/puppet.rb:175:in `<module:Puppet>'
          from C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/vendor_ruby/puppet.rb:81:in `<top (required)>'
          from C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in 
      `require'
          from C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in 
      `require'
          from C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/vendor_ruby/puppet/util/command_line.rb:12:in `<top 
      (required)>'
          from C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in 
      `require'
          from C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in 
      `require'
          from C:/Program Files/Puppet Labs/Puppet/puppet/bin/puppet:3:in `<main>'
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              chuck Charlie Sharpsteen
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Zendesk Support