Search code examples
google-cloud-platformgoogle-cloud-functionsgoogle-cloud-rungoogle-artifact-registry

aborting a cloud run service


I had cloud run service with a timeout of 60 mins and it connects to a redis instance in memorystore. I had an issue connecting to that specific instance, and in my code it keeps retrying until connection is successful. Because of the bug in my code it kept erroring on cloud run logs and I wasnt sure how to abort or kill this running cloud run service so I deleted it. After deleting the service, the error kept appearing until it reached the timeout limit - 60 mins. After about 60 minutes the errors were not being logged.

I am wondering why the error kept logging even after deleting the service? Does deleting the service not abort the process?


Solution

  • Serverless means you don't manage the underlying infrastructure, especially the servers and the instances (containers running on servers). It's up to Google to choose when to start and stop an instance. Even if you have a 60 minutes timeout instance, and Google must fix the server (or if the server has an outage) your instance will go down.

    Because of Google own choice, even if you delete a service, it's up to Google instance manager (also named Borg) to choose when to kill the instance.

    I don't know Google secret sauce. Maybe your instance is marked as "killable". But if Google don't need more resource, it won't kill your instance (like a garbage collector). If you test several times, you could have different behavior because it totally depend on Google Cloud usage, resource requirement and other customer needs!


    Anyway, when you delete the service, or the revision, you stop to pay for it. So, if your process continue, it's paid by Google. Ok, it generates noise in the logs, but it's the only consequence.