Skip to content

Conversation

@IvanBorislavovDimitrov
Copy link
Contributor

Hello colleagues,

I found a problem with the cf-java-client.
If you create an application with more than 2GB of memory/disk_quota and try to get the process statistics for this application the JSON parsing fails because the controller returns "memory/disk_quota" in bytes and exceeds the integer limits.
Check:
Numeric value (2147483648) out of range of int (-2147483648 - 2147483647)
at [Source: (byte[])"{
"resources": [
{
"type": "web",
"index": 0,
"state": "RUNNING",
"usage": {
"time": "2021-01-15T13:46:43+00:00",
"cpu": 0.0,
"mem": 285628069,
"disk": 250437632
},
"host": "10.0.137.7",
"uptime": 2,
"mem_quota": 2147483648,
"disk_quota": 1073741824,
"fds_quota": 16384,
"isolation_segment": null,
"details": null,
"instance_ports": [
{
"external": 61028,
"[truncated 1073 bytes]; line: 15, column: 30] (through reference chain: org.cloudfoundry.client.v3.applications.GetApplicationProcessStatisticsResponse$Json["resources"]->java.util.ArrayList[0]->org.cloudfoundry.client.v3.processes.ProcessStatisticsResource$Json["mem_quota"])

This fix is pretty simple and I would be happy to contribute it.

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Jan 18, 2021

CLA Signed

The committers are authorized under a signed CLA.

@dmikusa
Copy link
Contributor

dmikusa commented Jun 3, 2021

Thanks for the contribution and sorry for the delay. This looks good. I just need to run through the test suite. If that is green, I will merge this. Thanks

@dmikusa dmikusa added triaged Initial triage of issue has been performed bug client labels Jun 3, 2021
@dmikusa
Copy link
Contributor

dmikusa commented Jun 3, 2021

Tests pass. Merging.

This will change the ProcessStatistics API, since the function signature is changing from Integer to Long. That needs to be documented in the release notes.

Resolves: #1086

@dmikusa dmikusa merged commit a5be31a into cloudfoundry:main Jun 3, 2021
dmikusa pushed a commit that referenced this pull request Jun 4, 2021
This is a follow up to PR #1085 and was pointed out in PR #1064.
dmikusa pushed a commit that referenced this pull request Aug 20, 2021
dmikusa pushed a commit that referenced this pull request Aug 20, 2021
This is a follow up to PR #1085 and was pointed out in PR #1064.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug client triaged Initial triage of issue has been performed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants