cloudfoundry / cf-java-client

Java Client Library for Cloud Foundry
Apache License 2.0
328 stars 318 forks source link

JsonParsingException when Mem Quota at 2048MB #1127

Closed martinstraesser closed 2 years ago

martinstraesser commented 2 years ago

When trying to get the memory quota of a deployed app I'm getting a JSON deserialization failure when the quota is higher or equal to 2048M:

Exception:

org.cloudfoundry.reactor.util.JsonParsingException: Numeric value (2147483648) out of range of int (-2147483648 - 2147483647)
 at [Source: (byte[])"{
  "resources": [
    {
      "type": "web",
      "index": 0,
      "state": "RUNNING",
      "usage": {
        "time": "2022-01-03T08:13:09+00:00",
        "cpu": 0.3169208092861087,
        "mem": 751090955,
        "disk": 202764288
      },
      "host": "10.244.5.43",
      "uptime": 526,
      "mem_quota": 2147483648,
      "disk_quota": 2147483648,
      "fds_quota": 16384,
      "isolation_segment": null,
      "details": null,
      "instance_ports": [
        {
          "external":"[truncated 317 bytes]; line: 15, column: 30] (through reference chain: org.cloudfoundry.client.v3.processes.GetProcessStatisticsResponse$Json["resources"]->java.util.ArrayList[0]->org.cloudfoundry.client.v3.processes.ProcessStatisticsResource$Json["mem_quota"])] with root cause

com.fasterxml.jackson.core.exc.InputCoercionException: Numeric value (2147483648) out of range of int (-2147483648 - 2147483647)
 at [Source: (byte[])"{
  "resources": [
    {
      "type": "web",
      "index": 0,
      "state": "RUNNING",
      "usage": {
        "time": "2022-01-03T08:13:09+00:00",
        "cpu": 0.3169208092861087,
        "mem": 751090955,
        "disk": 202764288
      },
      "host": "10.244.5.43",
      "uptime": 526,
      "mem_quota": 2147483648,
      "disk_quota": 2147483648,
      "fds_quota": 16384,
      "isolation_segment": null,
      "details": null,
      "instance_ports": [
        {
          "external":"[truncated 317 bytes]; line: 15, column: 30]

I can provide more details if required. Is there a workaround available or is it possible to move datatype from int to long?

dmikusa commented 2 years ago

Thanks for the report. What version are you using? Have you tried the latest release? Either 5.6.0 or 4.16.0. These have some fixes for using long instead of int.

martinstraesser commented 2 years ago

Sorry cheap mistake from my side, had version 5.0.0.RELEASE running, upgrading to 5.6.0.RELEASE did the job. Thanks for the help.