Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Cloud Run memory limit doesn't seem honored

Hi - noticed my application was crashing due to running out of memory.

Here is the staging environment set to 1GiB:

siliconcow_0-1703454586615.png

However here is the out of memory error from the dashboard saying I only have 512:

siliconcow_1-1703454665622.png

Am I getting the memory I've set? (and probably being charged for?)

Thanks

Solved Solved
0 3 1,360
1 ACCEPTED SOLUTION

This appears to be a bug/issue with the console, the OOM error looks to be aggregated with previous OOM errors.  The first time I ran out of memory, it was at 512 and I guess all future OOM errors get aggregated under that (maybe I can delete/resolve it?).  

 

As for metrics, there doesn't appear to be actual memory used metric - just a % of memory used.  It was surprisingly difficult to get the actual memory available in the container.  I ended up building an endpoint to exec a command (guarded by a very long secret) which isn't ideal but I guess it's what you do in a serverless world.

View solution in original post

3 REPLIES 3

Hi,

Do you have more information in metrics tab?

The second generation of cloud run needs at least 512 MiB of memory.

So maybe GCP counts you 512 GiB on the out of memory because 1 GiB - 512 MiB = 512 MiB. If this is really the case, try with 2.5 GiB or use first generation instances (to recover some memory).

Hi @siliconcow,

Welcome to Google Cloud Community!

Try the following if either would fix the issue:

If the options above didn't work out, you may file this as a bug through this link so that our engineers could take a look at this.

Hope this helps.

 

This appears to be a bug/issue with the console, the OOM error looks to be aggregated with previous OOM errors.  The first time I ran out of memory, it was at 512 and I guess all future OOM errors get aggregated under that (maybe I can delete/resolve it?).  

 

As for metrics, there doesn't appear to be actual memory used metric - just a % of memory used.  It was surprisingly difficult to get the actual memory available in the container.  I ended up building an endpoint to exec a command (guarded by a very long secret) which isn't ideal but I guess it's what you do in a serverless world.