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

Cloud Run Job execution completed unexpectedly

Hi, I faced an issue with the Cloud Run Job, for some reason it exit with ''Container called exit(0)" when execution is not completed yet.
Resource utilization normal (no more than 50%), setup 16GB RAM, 8CPUs
Job timeout set to 168h. (execution before exit less than 3h)
No errors, no crashes, no 5** HTTP codes.

Job execute crawling and this issue is faced only with one website.
HTTP codes while crawling (200, 403, 429)
What can trigger container exit, I checked the documentation and every possible case for termination does not correspond to this.

How can I control container exit? Is it possible to exit in case some log is generated?
How to fix this issue?

 

0 1 297
1 REPLY 1

Hi @devsol,

It looks like your Cloud Run Job might be stopping because of some hidden conditions in your crawling code, how it's handling certain HTTP errors, or a timeout that's kicking in earlier than expected. Here are some workarounds that may help resolve the problem:

  • Try using Cloud Logging to get more detailed logs – this can help you figure out what's causing the container to exit. Check both the system logs and any custom logs to see if something unusual pops up when the job stops. You can also set up alerts for "exit" log entries to keep an eye on any unexpected terminations.
  • Take a look at your crawling code to see if it's using exit(0) or sys.exit() anywhere – these can make the container stop even if the job’s not done. Also, make sure you’ve got proper exception  handling in place for any network or crawling issues to prevent the job from ending unexpectedly.
  • Even though your timeout is set to 168 hours, the job might still be affected by health check issues or the container’s status. Check the Cloud Run Job logs to make sure the container is being marked as healthy and to see if any health checks are failing. Also, take a look at Cloud Run’s timeout guidelines to double-check the maximum allowed duration and any other rules that could impact how the job runs.
  • Even with 16GB of RAM and 8 CPUs set up, there might be an issue with how Cloud Run automatically scales. Make sure the scaling settings are right and check the configuration for scaling and handling multiple requests to avoid the job stopping too soon or running out of resources.


If the workarounds above don't work, you can contact Google Cloud Support for a more in-depth analysis. When contacting them, please provide comprehensive details and include screenshots. This will help them better understand and address your issue.

Was this helpful? If so, please accept this answer as “Solution”. If you need additional assistance, reply here within 2 business days and I’ll be happy to help.