ahmetb / cloud-run-faq

Unofficial FAQ and everything you've been wondering about Google Cloud Run.
https://cloud.run
Creative Commons Attribution 4.0 International
2.32k stars 124 forks source link

Cloud-Run Instances Receiving SIGTERM #149

Closed SteGaff7 closed 3 years ago

SteGaff7 commented 3 years ago

Hi,

I currently have multiple APIs deployed as cloud-run instances and have the minimum instances set to 1 for each. The ASP Net Core app within the docker container is restarting at random intervals (sometimes stays active for 2 days, other times 30mins) - this results in the first request to the restated app being slow which accumulates on the front-end quickly.

The container is receiving SIGTERM signal and I am wondering what are the potential causes for cloud-run to signal a container to terminate and restart, especially with the minimum instances set to 1.

Thanks Stephen

ahmetb commented 3 years ago

The containers (even with minInstances) will eventually be restarted (due to host machine maintenance, perhaps better binpacking at scheduling layer and such).

However, after the shutdown, if you set minInstances=1, the container should be coming up again (maybe on another host machine). So it would not cause cold-starts.

If you think this is too frequent or causing cold-starts, please visit Google Cloud Issue Tracker and submit a feedback.

SteGaff7 commented 3 years ago

Thank you

It is starting a new container, the first request to a new Net Core app is a little bit slower so was wondering why new containers were being started. I can address it from the C# code.