Search code examples
google-cloud-platformcontainerscloudgoogle-cloud-run

Memory limit exceeded error while the container memory utilization is below 55%


I'm having the following error in a service that runs on Cloud Run

Memory limit of 256M exceeded with 432M used

I don't understand why the service got such an error because from what I saw from the Container memory utilization, the service only uses around 50% of the total available memory.


Solution

  • The container memory utilization graph doesn't show the realtime values and doesn't pick the memory utilisation everytime. it picks the values time to time (I don't know the frequency should something like every 30s) and then show you the average/normal memory utilisation.

    However, if you have a pick in your usage (a big file, a special request,...) that, in a few milliseconds, crash the service because of OOM, the monitoring system doesn't have the time to pick the container memory utilisation value and to show it to you.

    You should investigate on the request that cause this OOM issue. You can also describe your service/share piece of code if you need help.