Uploaded image for project: 'PuppetDB'
  1. PuppetDB
  2. PDB-5364

Enabling log-queries in 7.7.1 causes JSON serialization failures

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Normal
    • Resolution: Fixed
    • PDB 6.19.1, PDB 7.7.1
    • PDB 6.20.0, PDB 7.9.0, 7.15.0
    • PuppetDB
    • None
    • HA
    • Needs Assessment
    • Bug Fix
    • Fixed an issue with queries filtering with arrays when log-queries is enabled.
    • Needs Assessment

    Description

      In PDB 7.7.1, if log-queries = true some PDB queries will fail with Cannot JSON encode object of class: class org.postgresql.jdbc.PgArray. This was working in 7.5.2. Disabling log-queries alleviates the issue.

       

      Reproduction

      1. Install 7.7.1 or PE 2021.4.0
      2. Set log-queries = true in the jetty.ini
      3. Run the following query and observe the error

      # curl -G http://localhost:8080/pdb/query/v4/facts --data-urlencode 'query=["extract", ["certname", "name", "value"], ["and", ["or", ["in", "certname", ["array", ["somenode"]]]], ["in", "name", ["array", ["aio_agent_version"]]]]]'
      Cannot JSON encode object of class: class org.postgresql.jdbc.PgArray: {"somenode"} 

       

      Impact

      This query is generated from bolt, so running bolt against a PE instance in 2021.4.0 with log-queries = true will fail.

       

      # bolt task run facts --targets $(puppet config print certname) --transport pcp
      Started on pe-server-16712b-0.us-west1-c.c.customer-support-scratchpad.internal...
      Failed on pe-server-16712b-0.us-west1-c.c.customer-support-scratchpad.internal:
        Query to PuppetDB v4/facts failed with query ["extract" ["certname" "name" "value"] ["and" ("or" ["in" "certname" ["array" ("pe-server-16712b-0.us-west1-c.c.customer-support-scratchpad.internal")]]) ["in" "name" ["array" ["aio_agent_version"]]]]]: Cannot JSON encode object of class: class org.postgresql.jdbc.PgArray: {"pe-server-16712b-0.us-west1-c.c.customer-support-scratchpad.internal"}
      Failed on 1 target: pe-server-16712b-0.us-west1-c.c.customer-support-scratchpad.internal
      Ran on 1 target in 0.55 sec 

       

      Workaround

      Set log-queries = false or remove the line from the jetty.ini

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              jarret.lavallee Jarret Lavallee
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Zendesk Support