'ResourceExhausted error in Pivotal cloud foundry

I am getting the below error whenever trying to invoke a SOAP endpoint which is deployed in PCF.

2019-03-07T06:55:22.817-05:00 [APP/PROC/WEB/0] [ERR] Resource 
exhaustion event.
 2019-03-07T06:55:22.817-05:00 [APP/PROC/WEB/0] [ERR] 
  ResourceExhausted! (1/0)
  2019-03-07T06:55:26.668-05:00 [APP/PROC/WEB/0] [OUT] | Instance 
  Count | Total Bytes | Class Name |
2019-03-07T06:55:26.669-05:00 [APP/PROC/WEB/0] [OUT] | 447836 | 
32342112 | [C |
2019-03-07T06:55:26.671-05:00 [APP/PROC/WEB/0] [OUT] | 297596 | 
11903840 | Ljava/util/LinkedHashMap$Entry; |

2019-03-07T06:55:26.796-05:00 [APP/PROC/WEB/0] [OUT] Memory usage:
2019-03-07T06:55:26.797-05:00 [APP/PROC/WEB/0] [OUT] Heap memory: init 
16777216, used 169257280, committed 409534464, max 409534464
2019-03-07T06:55:26.798-05:00 [APP/PROC/WEB/0] [OUT] Hint: Heap memory 
 is over 95% full. To increase it, increase the container size.
2019-03-07T06:55:26.799-05:00 [APP/PROC/WEB/0] [OUT] Non-heap memory: 
init 2555904, used 175238384, committed 180928512, max 495026176
2019-03-07T06:55:26.800-05:00 [APP/PROC/WEB/0] [OUT] Memory pool 
 usage:

Any workaround for the issue.



Solution 1:[1]

Make sure the PCF application has sufficient memory (based on your output the current max heap size is 400MB):

You need to increase both the application native size and the JVM max heap size:

cf scale my-application -m 1G
cf set-env my-app JAVA_OPTS '-Xmx768m'
cf cf restage my-application

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 João Pinto