I have a couple of Spring Boot services that work perfectly locally but they restart after random time on Google App Engine Flexible. These services use google Cloud SQL and Pub/Sub with help of the Spring Boot libraries.
When I deploy the services they work fine, but after a while they get restarted by App Engine. I hooked them up to an instance of Spring Boot admin and I can't see anything strange in the heap or disk space or any of these. Sometimes they reboot after a few hours, sometimes faster.
I tried bumping the logging to trace logging and it seems the services get restarted faster.
I also noticed that the healthcheck gets called a lot, even though the default configuration of the healthcheck says it should be 5 mins and a couple of failed consecutive healthchecks google app yaml config. But I never see any failed healthchecks in the logs.
The thing I see is that the healthchecks go well (200 reply), and then suddenly the logging stops, and a couple of minutes later i see
Start command: java -showversion -agentpath:/opt/cdbg/cdbg_java_agent.so=--log_dir
which means that app engine is trying to start the app again.
The app.yaml looks like:
runtime: java
env: flex
service: x-service
resources:
memory_gb: 1.0
automatic_scaling:
min_num_instances: 1
max_num_instances: 2
env_variables:
SPRING_PROFILES_ACTIVE: "dev"
liveness_check:
path: "/actuator/health"
readiness_check:
path: "/actuator/health"