I'm chasing a problem where our app slowly uses more and more db 
connections. QueuePool eventually logs a TimeoutError because it has run 
out of available connections. (SA 0.9.4)

The app has a background task that wakes up and checks the db for any 
pending work. Most of time, the check-out/return-to-pool is what I'd expect 
(grab 3 connections from the pool, use them, return them). But once in a 
while, the QueuePool decides to create a new connection. This happens even 
though there's connections that have been returned to the pool. Here's an 
example:

sqlalchemy.pool.QueuePool Connection <connection object at 0x47cb340; dsn: 
'dbname=iia user=postgres host=lspdbsrvr03.localdomain port=5432', closed: 
0> checked out from pool
sqlalchemy.pool.QueuePool Connection <connection object at 0x4498fe0; dsn: 
'dbname=iia user=postgres host=lspdbsrvr03.localdomain port=5432', closed: 
0> checked out from pool
sqlalchemy.pool.QueuePool Connection <connection object at 0x4498fe0; dsn: 
'dbname=iia user=postgres host=lspdbsrvr03.localdomain port=5432', closed: 
0> being returned to pool
sqlalchemy.pool.QueuePool Connection <connection object at 0x4498fe0; dsn: 
'dbname=iia user=postgres host=lspdbsrvr03.localdomain port=5432', closed: 
0> rollback-on-return, via agent
sqlalchemy.pool.QueuePool Connection <connection object at 0x47cb340; dsn: 
'dbname=iia user=postgres host=lspdbsrvr03.localdomain port=5432', closed: 
0> being returned to pool
sqlalchemy.pool.QueuePool Connection <connection object at 0x47cb340; dsn: 
'dbname=iia user=postgres host=lspdbsrvr03.localdomain port=5432', closed: 
0> rollback-on-return, via agent
sqlalchemy.pool.QueuePool Created new connection <connection object at 
0x490e190; dsn: 'dbname=iia user=postgres host=lspdbsrvr03.localdomain 
port=5432', closed: 0>

What would cause the QueuePool to allocate a new connection when there's 
obviously connections available in the pool?

It's the same task loop running over-and-over (the task is not even getting 
new work), so there shouldn't be anything changing there.

--
Bill

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to