google java flex内存不足,502 Bad Gateway作为响应

时间:2018-05-04 15:36:20

标签: google-app-engine spring-boot gcloud app-engine-flexible

我在google appengine灵活环境中使用以下配置部署了一个spring boot应用程序

env: flex
runtime: java
service: default

health_check:
  enable_health_check: False

manual_scaling:
  instances: 1

一切都运行良好,并且在所有休息终点直到今天早上。现在它为任何电话提供502 Bad Gateway

当我挖掘更多在日志中发现它的内存问题。日志显示如下错误。命令读取日志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)

任何人都解决了这个问题。

1 个答案:

答案 0 :(得分:0)

今天早些时候,我遇到了类似的问题,并且意识到GCP分配了内存不足,因此我设法通过在 app.yaml 中定义分配的内存来解决该问题,如下所示:

resources:
  cpu: 1
  memory_gb: 2
  disk_size_gb: 10