#26619 [Bug]: Gunicorn worker recycling via --max_requests_before_restart leaks Postgres connections โ no keepalive configured, orphaned connections held for ~2 hours by Cloud SQL
### Check for existing issues
- [x] I have searched the existing issues and checked that my issue is not a duplicate.
### What happened?
When running LiteLLM with `--run_gunicorn`, `--num_workers > 1`, and `--max_requests_before_restart`, Postgres connections accumulate on the database side and are never released until the OS TCP keepalive timeout (~2 hours on Cloud SQL / standard Linux). The pod itself never restarts โ the leak is entirely driven by Gunicorn worker recycling inside live pods.
### Root cause (confirmed by source)
**1. `proxy_shutdown_event()` is called with no try/except in the lifespan shutdown** (`proxy_server.py:1005`):
\`\`\`python # proxy_server.py ~line 1005 await proxy_shutdown_event() # no try/except โ exception aborts lifespan shutdown \`\`\`
**2. `PrismaClient.disconnect()` re-raises on failure** (`utils.py:3799`):
\`\`\`python async def disconnect(self): try: await self.db.disconnect() except Exception as e: # logs, then: raise e # propagates up through proxy_shutdown_event โ lifespan โ unhandled \`\`\`
**3. If `disconnect()` raises, the lifespan context manager exits with an exception.** Uvicorn catches this โฆ