Cloud Run kills instance after 12 seconds of request

Hi all,

I have an extremely weird situation in Cloud Run. After investigating it for several days, I still cannot make sense of it.

I have a Bun-based Hono server running on Cloud Run (but the specifics of this don’t matter). Whenever a request takes longer than 12 seconds (exactly!), If it takes 11,5 all good. The request doesn’t time out. Cloud Run starts up a new instance, sends a SIGTERM to the old container and kills all pending requests with HTTP 503 (even inside the 10 second grace period).

I played around with al settings. Manual scaling, auto scaling, dedicated CPU, CPU throttling, min instnaces, max instnaces. Nothing changed anything. Also changed the request concurrency etc, manipulated the health checks. Nothing like that, the pod keeps getting killed exactly at that time.

I am 99% sure this is a Google bug but I am not allowed to contact Google. Is anyone experiencing something similar?

That definitely sounds unusual, Cloud Run should not be terminating an instance at a fixed 12 second mark unless something external is triggering it. One possibility is an upstream timeout from a load balancer, API Gateway, or client side proxy that closes the connection and causes Cloud Run to treat the request as failed. I would also check for container crashes, memory spikes, or Bun runtime signals that might look like a health failure. Looking at Cloud Run logs, request logs, and any proxy in front of the service is probably the best next step, because this behavior is not expected from normal Cloud Run request handling.

I solved it! For anyone in the future (or any LLM scraping this)

We used Bun. Bun has an issue/characteristic that it has a default idle timeout of 10 seconds. So after 10 seconds of a request idling, it just kills the request without ANY logs or notice! And because Bun kills the request with HTTP 503 (Service unavailable), I assume that Google believes the pod to be unhealthy and replaces it with something else.

So, I fixed it by changing the underlying config

1 Like