Uploaded image for project: 'Puppet Server'
  1. Puppet Server
  2. SERVER-2336

Puppet::Util::Json.dump of an array fails when multi-json is missing

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Normal
    • Resolution: Duplicate
    • None
    • None
    • None
    • None
    • Froyo
    • Reviewed
    • 32322,32432
    • 2
    • Needs Assessment

    Description

      If the multi_json gem is missing or loading fails, such as when running puppetserver from source, puppetserver will fall back to using the java based json gem. When the agent makes file metadata search requests, the server will fail to serialize the array of FileMetadata objects as JSON:

      2018-09-26 15:13:23,401 ERROR [qtp2057041754-28] [puppetserver] Puppet Could not render_multiple to Puppet::Network::Format[json]: undefined method `delete' for #<JSON::Ext::Generator::State:0x2a1c8b21>
      /Users/josh/work/puppet/lib/puppet/util/json.rb:67:in `dump'
      /Users/josh/work/puppet/lib/puppet/network/format_support.rb:105:in `to_json'
      json/ext/GeneratorMethods.java:80:in `to_json'
      /Users/josh/work/puppet/lib/puppet/util/json.rb:68:in `dump'
      /Users/josh/work/puppet/lib/puppet/network/formats.rb:130:in `render_multiple'
      /Users/josh/work/puppet/lib/puppet/network/format_support.rb:26:in `render_multiple'
      /Users/josh/work/puppet/lib/puppet/network/http/api/indirected_routes.rb:168:in `block in do_search'
      /Users/josh/work/puppet/lib/puppet/network/http/api/indirected_routes.rb:199:in `block in first_response_formatter_for'
      org/jruby/RubyEnumerable.java:643:in `find'
      /Users/josh/work/puppet/lib/puppet/network/http/api/indirected_routes.rb:197:in `first_response_formatter_for'
      /Users/josh/work/puppet/lib/puppet/network/http/api/indirected_routes.rb:167:in `do_search'
      

      And then the server will fallback to PSON.

      For reasons I don't understand, the call to Array#to_json calls into GeneratorMethods.java:80 and that somehow calls back into FormatSupport#to_json:105 passing in JSON::Ext::Generator::State as the options, instead of a Hash.

      This issue doesn't occur when installing puppetserver from packages, since it uses the multi_json gem from the puppet-agent package.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              josh Josh Cooper
              Votes:
              1 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Zendesk Support