The Background Task That Froze: A Serverless CPU-Throttling Mystery
7.8 relevance
Score Breakdown
technical depth 9
novelty 6
actionability 9
community 6
strategic 5
personal 10
Scored daily by a customisable AI persona to surface the most relevant engineering leadership news.
Serverless CPU throttling mystery on Cloud Run is directly actionable for cloud engineers.
Summary
On Cloud Run with default request-based CPU mode, post-response background tasks (e.g., FastAPI's `BackgroundTasks` or `asyncio.create_task`) freeze after the HTTP response is sent because the platform throttles CPU to near zero between requests. The frozen task only resumes when another request arrives, causing unpredictable delays or silent data loss if the instance scales to zero. This behavior is invisible in logs because no error is thrown — the event loop simply isn't scheduled.