1

I deployed a spring boot application in google appengine flexible environment with below configuration

env: flex
runtime: java
service: default

health_check:
  enable_health_check: False

manual_scaling:
  instances: 1

Everything was running fine and and alto call all rest end point till today morning. Now its giving 502 Bad Gateway for any call.

When I dig more found out in the log that its a memory issue. the log shows below error. command to read log gcloud app logs read.

#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 12288 bytes for committing reserved memory.
# An error report file with more information is saved as:
# //hs_err_pid1.log
# [ timer expired, abort... ]
[thread 140186444871424 also had an error]
OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00007f7fb03d7000, 12288, 0) failed; error='Cannot allocate memory' (errno=12)

Anyone resolved this issue.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Aniruddha Das
  • 20,520
  • 23
  • 96
  • 132
  • 1
    See https://cloud.google.com/appengine/docs/flexible/java/dev-java-only. What is your HEAP_SIZE_RATIO? Since it defaults to 80, maybe you can try setting it to a lower value to see if that helps. I do not know what would be causing this issue. – Robin Green May 04 '18 at 20:14
  • Thank you so much for this suggestion. It look like it will resolve my problem. for now I have redeployed my spring boot application with auto scaling with 1-15 instances, not sure it will resolve the issue or not. If it does not, I will try your suggestion. BTW Thank you again for suggestion. I spent entire day to resolve this. – Aniruddha Das May 04 '18 at 20:31

1 Answers1

1

I had a similar issue earlier today, and realised that GCP allocated low memory, so I managed to fix it by defining the allocated memory in app.yaml, like below:

resources:
  cpu: 1
  memory_gb: 2
  disk_size_gb: 10
rmartinus
  • 690
  • 1
  • 9
  • 14