Async & Concurrency
The event loop, blocking calls, Celery and background work.
6 articles
Celery's unresolved worker memory leak: what actually helps when nothing fixes it
Celery's parent process RAM climbs for days with no confirmed cause upstream. Here is what the open issue really says, and the mitigations that hold your server up meanwhile.
The asyncio SSL Memory Leak Nobody Warns You About, and How to Work Around It
Long-running asyncio TLS services can leak memory in the SSL transport, growing RSS until the OOM killer strikes. Here is how to confirm it, mitigate it, and track the real fix.
pytest-asyncio 'event loop is already running': there is no patch coming
request.getfixturevalue() on an async fixture crashes pytest-asyncio, nest_asyncio no longer saves you, and upstream has no fix. Here is the test architecture that works instead.
Pydantic v2 'MockValSer object cannot be converted to SchemaSerializer': The Real Cause
This cryptic Pydantic v2 TypeError means your model schema never finished building, usually an unresolved forward reference. Here is the fix, not a workaround.
Why Your FastAPI 'async' Endpoints Run in Serial: The Blocking Event Loop Trap
FastAPI processing requests one at a time? async def does not make blocking code async. Here is why the event loop serialises, and the def vs async fix.
Celery Task Received but Not Executing: The Four Real Causes
Celery logs 'Received task' then runs nothing, with no error. It is one symptom with four unrelated causes. How to tell them apart with py-spy instead of guessing at flags.