Application Server 7
  1. Application Server 7
  2. AS7-4913

Server sends "big integer <val>" for config entries when a reload is needed

    Details

    • Bugzilla Update:
      Perform
    • Similar Issues:
      Show 10 results 

      Description

      RHQ sends JSON like this to change e.g. the max-pool-size setting of a data source:

      {"operation":"composite","steps":[{"operation":"write-attribute","address":[

      {"subsystem":"datasources"}

      ,

      {"data-source":"ExampleDS"}

      ],"name":"max-pool-size","value":75},{"operation":"write-attribute","address":[

      {"subsystem":"datasources"}

      ,

      {"data-source":"ExampleDS"}

      ],"name":"use-fast-fail","value":false}],"address":[]}

      Server returns success.
      When I directly go to the cli afterwards I see:

      [standalone@localhost:9999 /] /subsystem=datasources/data-source=ExampleDS:read-attribute(name=max-pool-size)
      {
      "outcome" => "success",
      "result" => big integer 75,
      "response-headers" =>

      {"process-state" => "restart-required"}

      }

      Note the "big integer"

      [standalone@localhost:9999 /] /:reload

      {"outcome" => "success"}

      [standalone@localhost:9999 /] /subsystem=datasources/data-source=ExampleDS:read-attribute(name=max-pool-size)

      { "outcome" => "success", "result" => 75 }

      [standalone@localhost:9999 /]

      Now the server acts as always.

        Issue Links

          Activity

          Hide
          Jan Martiska
          added a comment -

          example CURL command which will cause this bug to appear:

          curl http://localhost:9990/management/ -d '{"operation":"write-attribute","address":[{"subsystem":"datasources"},{"data-source":"ExampleDS"}],"name":"max-pool-size","value":90}' -HContent-Type:application/json
          
          Show
          Jan Martiska
          added a comment - example CURL command which will cause this bug to appear: curl http://localhost:9990/management/ -d '{"operation":"write-attribute","address":[{"subsystem":"datasources"},{"data-source":"ExampleDS"}],"name":"max-pool-size","value":90}' -HContent-Type:application/json
          Hide
          Brian Stansberry
          added a comment -

          We should get this sorted by 7.2.0.CR1 at the latest. It's either a simple bug in the JCA subsystems or there is a problem in jboss-dmr's unmarshalling of JSON. If it's the latter, I'd like to know ASAP.

          Show
          Brian Stansberry
          added a comment - We should get this sorted by 7.2.0.CR1 at the latest. It's either a simple bug in the JCA subsystems or there is a problem in jboss-dmr's unmarshalling of JSON. If it's the latter, I'd like to know ASAP.
          Hide
          Stefano Maestri
          added a comment -

          it seems an unmarshalling problem, since I'm getting this operation even in AbstractWriteAttributeHandler#execute
          {
          "operation" => "write-attribute",
          "address" => [

          {"subsystem" => "datasources"}

          ,

          {"data-source" => "ExampleDS"}

          ],
          "name" => "max-pool-size",
          "value" => big integer 90
          }

          Show
          Stefano Maestri
          added a comment - it seems an unmarshalling problem, since I'm getting this operation even in AbstractWriteAttributeHandler#execute { "operation" => "write-attribute", "address" => [ {"subsystem" => "datasources"} , {"data-source" => "ExampleDS"} ], "name" => "max-pool-size", "value" => big integer 90 }
          Hide
          Brian Stansberry
          added a comment -

          David, is this a bug in the JSON parser, or just a limitation we need to deal with?

          Show
          Brian Stansberry
          added a comment - David, is this a bug in the JSON parser, or just a limitation we need to deal with?
          Hide
          Brian Stansberry
          added a comment -

          As for the limitation question, it's a weakness in our operation handling that we aren't converting operation inputs into the expected ModelType before storing in the model. We are validating that the provided type is convertible, but we aren't actually converting, e.g. reading ModelType.BIG_INTEGER but storing ModelType.INT.

          The validation in ModelTypeValidator has flaws as well, since it's relying on the ModelNode throwing an exception if the conversion is invalid. But BigIntegerModelValue will not throw an exception from asInt() if a narrowing would occur.

          Show
          Brian Stansberry
          added a comment - As for the limitation question, it's a weakness in our operation handling that we aren't converting operation inputs into the expected ModelType before storing in the model. We are validating that the provided type is convertible, but we aren't actually converting, e.g. reading ModelType.BIG_INTEGER but storing ModelType.INT. The validation in ModelTypeValidator has flaws as well, since it's relying on the ModelNode throwing an exception if the conversion is invalid. But BigIntegerModelValue will not throw an exception from asInt() if a narrowing would occur.
          Hide
          David Lloyd
          added a comment -

          The JSON parser makes decisions based solely on the lexical input. For hex values, if the number is padded to less than 8 digits it becomes an int, if more than 8 digits it becomes a long. For base-10 integers, it simply always assumes big integer. It would however be simple enough to change the logic to always parse to a BigInteger regardless of input base, and then use magnitude comparisons to reduce it to a long or int as appropriate.

          Show
          David Lloyd
          added a comment - The JSON parser makes decisions based solely on the lexical input. For hex values, if the number is padded to less than 8 digits it becomes an int, if more than 8 digits it becomes a long. For base-10 integers, it simply always assumes big integer. It would however be simple enough to change the logic to always parse to a BigInteger regardless of input base, and then use magnitude comparisons to reduce it to a long or int as appropriate.
          Hide
          Brian Stansberry
          added a comment -

          I think using magnitude comparisons and reducing makes sense.

          Show
          Brian Stansberry
          added a comment - I think using magnitude comparisons and reducing makes sense.
          Show
          David Lloyd
          added a comment - - edited http://github.com/jbossas/jboss-dmr/compare/d9fb8d7...0029b31
          Hide
          Brian Stansberry
          added a comment -

          jboss-dmr 1.1.4 with this fix in it is integrated in AS master.

          Show
          Brian Stansberry
          added a comment - jboss-dmr 1.1.4 with this fix in it is integrated in AS master.

            People

            • Assignee:
              David Lloyd
              Reporter:
              Heiko Rupp
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: