What this thread does
QueuePool limit of size 10 overflow 10 reached, connection timed out, timeout 30.00 An application caller waited for a pooled connection until the configured deadline expired. Do first: add echo_pool="debug" to the existing create_engine() call and repeat one failing request while watching connection acquisition and return events. Pool logging Evidence: the official error guide defines pool exhaustion; a public contention report contains this numeric example, so the message alone cannot establish a connection leak. Error guide, public report Not for: async SQLAlchemy MissingGreenlet; see sqlalchemy-async-missinggreenlet-lazy-load-fixes.
As of November 2026, the branches below target synchronous SQLAlchemy 2.0.57, released November 3, 2026. The numbers in your exception reflect your own pool configuration.
Diagnostic: QueuePool connection timeout
1. Connections stay acquired after requests finish — SQLAlchemy 2.0.57. Follow 2.0 Session lifecycle. Put the request's database work inside with Session(engine) as session:; for a unit that should commit on success, use with Session(engine) as session, session.begin():. Context exit closes the session, and the transaction context handles commit or rollback. Exercise both a normal request and an exception path. In the pool log, expect a return after each request's database scope; repeat beyond the pool's capacity sequentially and confirm the timeout does not recur. Do not depend on garbage collection to release sessions. Error-guide explanation
2. Returns happen only after slow external work — SQLAlchemy 2.0.57. Follow 2.0 transaction lifetime guidance. Move user interaction, remote API waiting and unrelated job work outside the session's transaction block. Keep the database operation in its own with session.begin(): scope and close the session before the external wait. Repeat concurrent requests: connection-return events should occur before the external wait finishes. If the database operation itself remains slow or blocked, investigate that query or lock; increasing pool_timeout only changes how long a caller waits.
3. Every connection returns promptly, but legitimate concurrency exceeds capacity — SQLAlchemy 2.0.57. Follow 2.0 QueuePool sizing and engine parameters. Budget each process's pool_size + max_overflow against the database allowance, including other services. If the budget permits 20 connections per process, an example is create_engine(existing_url, pool_size=20, max_overflow=0, pool_timeout=30, echo_pool="debug"). Recreate the application engine through a controlled application restart. Under representative concurrency, confirm connections return and requests complete within the chosen deadline. Twenty is an example, not a default recommendation; unlimited overflow can shift the failure to the database.
Evidence and limits
On February 8, 2022, msg555 supplied a contention reproduction in SQLAlchemy 1.4.29 with the same timeout family and balanced acquisition/release logic. This is evidence that timeouts can have causes beyond missing cleanup, not proof of a current 2.0.57 fairness defect or a reason to add sleeps. SQLAlchemy #7679
This case assumes a synchronous Engine using QueuePool. Pool configuration applies per Engine and process, not to the whole deployment. A long-running transaction can occupy a connection even when no SQL is currently executing. The stopping condition is timely request completion with connection returns under your workload, not merely a larger wait timeout. 2.0 pooling behavior
Not for: async SQLAlchemy MissingGreenlet; see sqlalchemy-async-missinggreenlet-lazy-load-fixes.
Started from a post by @SQLAlchemy, packaged by the editor. Original post