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

Exceptions when using functions

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: PDB 4.2.0
    • Component/s: PuppetDB
    • Labels:
      None
    • Template:
    • Story Points:
      1

      Description

      When using any of the PQL functions it is very easy to get PuppetDB to throw a Input to munge-result-row does not match schema error. When this is thrown PuppetDB never responds to the query, causing it to timeout.

      All queries below are calling the root endpoint i.e. http://(master):8080/pdb/query/v4?query=(query)

      e.g. The following query:

      fact_contents[value] { path ~> ["memory",".*","available_bytes"] }
      

      Returns the following data as expected:

      [
        {
          "value": 693243904
        },
        {
          "value": 693268480
        },
        {
          "value": 3061817344
        }
      ]
      

      However if I try to average these numbers:

      fact_contents[avg(value)] { path ~> ["memory",".*","available_bytes"] }
      

      I get the following exception in the PuppetDB logs:

      clojure.lang.ExceptionInfo: Input to munge-result-row does not match schema: [(named {:avg disallowed-key} row)]
              at puppetlabs.puppetdb.query.fact_contents$eval26634$munge_result_row__26639.invoke(fact_contents.clj:22) ~[na:na]
              at clojure.core$map$fn__4785.invoke(core.clj:2646) ~[puppetdb.jar:na]
              at clojure.lang.LazySeq.sval(LazySeq.java:40) ~[puppetdb.jar:na]
              at clojure.lang.LazySeq.seq(LazySeq.java:49) ~[puppetdb.jar:na]
              at clojure.lang.LazySeq.first(LazySeq.java:71) ~[puppetdb.jar:na]
              at clojure.lang.RT.first(RT.java:667) ~[puppetdb.jar:na]
              at clojure.core$first__4339.invokeStatic(core.clj:55) ~[puppetdb.jar:na]
              at clojure.core$first__4339.invoke(core.clj:55) ~[puppetdb.jar:na]
              at puppetlabs.puppetdb.query_eng$eval26835$produce_streaming_body__26840$fn__26841$fn__26845$fn__26847$fn__26848$fn__26851.invoke(query_eng.clj:182) ~[na:na]
              at clojure.core$comp$fn__4727.invoke(core.clj:2460) ~[puppetdb.jar:na]
              at clojure.core$comp$fn__4727.invoke(core.clj:2460) ~[puppetdb.jar:na]
              at puppetlabs.puppetdb.jdbc$with_query_results_cursor$fn__21251.invoke(jdbc.clj:344) ~[na:na]
              at clojure.java.jdbc$db_transaction_STAR_.invokeStatic(jdbc.clj:620) ~[na:na]
              at clojure.java.jdbc$db_transaction_STAR_.doInvoke(jdbc.clj:568) ~[na:na]
              at clojure.lang.RestFn.invoke(RestFn.java:425) ~[puppetdb.jar:na]
              at puppetlabs.puppetdb.jdbc$with_query_results_cursor.invokeStatic(jdbc.clj:337) ~[na:na]
              at puppetlabs.puppetdb.jdbc$with_query_results_cursor.invoke(jdbc.clj:326) ~[na:na]
              at puppetlabs.puppetdb.query_eng$eval26835$produce_streaming_body__26840$fn__26841$fn__26845$fn__26847$fn__26848.invoke(query_eng.clj:179) ~[na:na]
              at puppetlabs.puppetdb.jdbc$with_transacted_connection_fn$fn__21230$fn__21231.invoke(jdbc.clj:306) ~[na:na]
      

      However if I try seemingly the exact same thing using a different entity:

      facts[value] { certname ~ "agent" and name = "uptime_seconds"}
      

      Returns:

      [
        {
          "value": 20844
        },
        {
          "value": 20757
        }
      ]
      

      And If I try to average it:

      facts[avg(value)] { certname ~ "agent" and name = "uptime_seconds"}
      

      It works:

      [
        {
          "avg": 20800.5
        }
      ]
      

      This seems weird given that the input data for each function seems to be in the exact same format. This not only applicable to the avg() function. In situations where it fails, it will fail regardless of the function that is used.

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            dylan.ratcliffe Dylan Ratcliffe
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Zendesk Support