api
resource_error
ai_generated
true
503 Service Unavailable: Connection pool exhausted. Maximum connections to backend reached.
ID: api/rate-limit-connection-pool-exhausted
78%Fix Rate
85%Confidence
1Evidence
2023-09-05First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| Python requests 2.31.0 | active | — | — | — |
| Node.js http module 18.x | active | — | — | — |
| Go net/http 1.21 | active | — | — | — |
Root Cause
Client-side HTTP connection pool (e.g., requests.Session or Node.js http.Agent) has no available connections due to slow responses or leaks.
generic中文
客户端HTTP连接池(如requests.Session或Node.js http.Agent)因慢响应或泄漏而无可用连接。
Official Documentation
https://docs.python-requests.org/en/latest/user/advanced/#transport-adaptersWorkarounds
-
80% success Increase connection pool size and add idle timeout. In Python requests: session = requests.Session(); adapter = requests.adapters.HTTPAdapter(pool_connections=100, pool_maxsize=100, max_retries=3); session.mount('https://', adapter); session.mount('http://', adapter)
Increase connection pool size and add idle timeout. In Python requests: session = requests.Session(); adapter = requests.adapters.HTTPAdapter(pool_connections=100, pool_maxsize=100, max_retries=3); session.mount('https://', adapter); session.mount('http://', adapter) -
75% success Enable connection reuse with keepalive and reduce request timeout. For Node.js: const agent = new http.Agent({ keepAlive: true, maxSockets: 25, timeout: 60000 });
Enable connection reuse with keepalive and reduce request timeout. For Node.js: const agent = new http.Agent({ keepAlive: true, maxSockets: 25, timeout: 60000 }); -
70% success Add retry with exponential backoff for 503 errors to allow connections to be released.
Add retry with exponential backoff for 503 errors to allow connections to be released.
中文步骤
Increase connection pool size and add idle timeout. In Python requests: session = requests.Session(); adapter = requests.adapters.HTTPAdapter(pool_connections=100, pool_maxsize=100, max_retries=3); session.mount('https://', adapter); session.mount('http://', adapter)Enable connection reuse with keepalive and reduce request timeout. For Node.js: const agent = new http.Agent({ keepAlive: true, maxSockets: 25, timeout: 60000 });Add retry with exponential backoff for 503 errors to allow connections to be released.
Dead Ends
Common approaches that don't work:
-
60% fail
Increasing max_connections arbitrarily without addressing slow backend responses leads to memory exhaustion and worse performance.
-
70% fail
Restarting the application without adjusting timeout settings causes the pool to exhaust again quickly under load.