Hi
I’d like to know how Cloud Run ends a request on timeout (For example, sending SIGTERM signal etc). Some requests were ended due to timeout and trace/profile data related with the requests didn’t show up Cloud Trace and Cloud Profiler, so I want to know what’s happen on timeout in Cloud Run and avoid these situation on Cloud Trace and Cloud Profiler.
I’ve already read these articles below,
https://cloud.google.com/run/docs/configuring/request-timeout
https://cloud.google.com/blog/topics/developers-practitioners/graceful-shutdowns-cloud-run-deep-dive?hl=en
https://cloud.google.com/run/docs/container-contract#responses
Hi @kamillle ,
The documents you provided generally answer your question and pretty much explain everything.
As mentioned in the Documentation :
For Cloud Run services, the request timeout setting specifies the time within which a response must be returned by services deployed to Cloud Run. If a response isn’t returned within the time specified, the request ends and error 504 is returned.> > The timeout is set by default to 5 minutes and can be extended up to 60 minutes. You can change this setting when you deploy a container image or by updating the service configuration. In addition to changing the Cloud Run request timeout, you should also check your language framework to see whether it has its own request timeout setting that you must also update.
According to this documentation which regards to trapping termination signal (SIGTERM) sent to the container instance.
“Cloud Run sends a SIGTERM signal to your container instance before the container instance terminates, due to an event like scale down or deleted revision. By handling this signal, you can now gracefully terminate your applications and do some cleanup tasks–as opposed to an abrupt shutdown of the container.”
You can see graceful shutdown in action through this link.
Forced termination occurs whenever a Cloud Run container instance exceeds the allowed memory limit. All requests that are still processing on the container instance end with an HTTP 500
error.
“If a task exceeds the task timeout, Cloud Run sends a ‘SIGTERM’ signal indicating the start of a 10 second period before the actual shutdown occurs, at which point Cloud Run sends a SIGKILL
signal, shutting down the container instance.”
Hi, @anjelisa !! Thank you for your answer and I still have a unclear point.
According to your answer, it seems that Cloud Run shuts down a request by sending SIGTERM but these documents I provided only mention Cloud Run ends a request and return 504 errors on timeout and these don’t mention how Cloud Run ends a request on timeout.
So, I need to know why you think Cloud Run ends a request by sending SIGTERM please.
"If a task exceeds the task timeout, Cloud Run sends a ‘SIGTERM’ signal indicating the start of a 10 second period before the actual shutdown occurs, at which point Cloud Run sends a SIGKILL signal, shutting down the container instance.
link
Actually this explanation is about Cloud Run Jobs and in this case, I need to know Cloud Run services..