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

Cloud Function continuously getting timeout without giving error

I am implementing tensorflow in cloud function with python 3.7. It was running fine earlier. Since last 9 hours it when I re-deployed it started giving timed-out even with old code which was running fine.

It is getting stuck at line

result = tensorflow_hub_model(img_array)

 Ram used is 4GB.

Please help.

0 6 3,239
6 REPLIES 6

jkg
Google Developer Expert
Google Developer Expert

Hey @tusharwagh10 is it possible with your redeploy that some of the default settings have been re-applied?

How are you deploying the function? Is it through the gcloud cli or terraform or via the console?

If, for example the cause is that the function is timing out, it's possible that redeploying the function via the CLI (for example) means that if a flag wasn't passed in that it would revert back to the default timeout, rather than a longer one?

I am deploying through console. Default settings are same. I have realized that CPU is getting allocated only 1.3 GHz and I should get 4.8 GHz on selecting 4 GB RAM. That might be reason for time-out. It is getting time-out at the line of script where heavy computation is required.
Refer  to screenshot.cf_error.jfif

No reply ?

Please reply.

Hey Tushar - I'm not sure why it would be timing out, especially as you say, it was working before, regardless of the CPU clock speed.

Perhaps upping the resources for the function might help, or you can run the heavy computation on compute engine VM.

Cloud functions are designed for simple, light-weight processing. You could also try cloud run and specify beefier instances with more ram and CPU to meet your needs.

I have tried using highest possible resource of cloud function i.e 8 GB RAM but still the issue was there. Can you please check with someone working on the core part of cloud function ?

Did you solve this issue? I am facing the same problem. Please let me know.

Thanks