I noticed some strange behavior with QueuePool when the pool_size is
exactly 1.
(this is with 1.0.13). With an app that basically does this:
e = sa.create_engine(..., pool_size=N)
while True:
with e.begin() as trans:
# perform a simple query
I see this behavior (observed with strace, but turning on connection
logging will do it too):
With pool_size == 1, db connections opened, used, and then closed.
With pool_size == 2, *two* database connections remain open, neither are
closed.
Something seems weird with pool_size==1. :-(
The logs:
DEBUG:sqlalchemy.pool.QueuePool:Created new connection <connection object
at 0x2d7db10; dsn: 'dbname=zarp', closed: 0>
DEBUG:sqlalchemy.pool.QueuePool:Connection <connection object at 0x2d7db10;
dsn: 'dbname=zarp', closed: 0> checked out from pool
DEBUG:sqlalchemy.pool.QueuePool:Connection <connection object at 0x2d7db10;
dsn: 'dbname=zarp', closed: 0> being returned to pool
DEBUG:sqlalchemy.pool.QueuePool:Connection <connection object at 0x2d7db10;
dsn: 'dbname=zarp', closed: 0> rollback-on-return
DEBUG:sqlalchemy.pool.QueuePool:Connection <connection object at 0x2dbb390;
dsn: 'dbname=zarp', closed: 0> being returned to pool
DEBUG:sqlalchemy.pool.QueuePool:Connection <connection object at 0x2dbb390;
dsn: 'dbname=zarp', closed: 0> rollback-on-return
DEBUG:sqlalchemy.pool.QueuePool:Closing connection <connection object at
0x2dbb390; dsn: 'dbname=zarp', closed: 0>
DEBUG:sqlalchemy.pool.QueuePool:Connection <connection object at 0x2d7db10;
dsn: 'dbname=zarp', closed: 0> checked out from pool
DEBUG:sqlalchemy.pool.QueuePool:Created new connection <connection object
at 0x2dbb390; dsn: 'dbname=zarp', closed: 0>
DEBUG:sqlalchemy.pool.QueuePool:Connection <connection object at 0x2dbb390;
dsn: 'dbname=zarp', closed: 0> checked out from pool
DEBUG:sqlalchemy.pool.QueuePool:Connection <connection object at 0x2dbb390;
dsn: 'dbname=zarp', closed: 0> being returned to pool
DEBUG:sqlalchemy.pool.QueuePool:Connection <connection object at 0x2dbb390;
dsn: 'dbname=zarp', closed: 0> rollback-on-return
DEBUG:sqlalchemy.pool.QueuePool:Connection <connection object at 0x2d7db10;
dsn: 'dbname=zarp', closed: 0> being returned to pool
DEBUG:sqlalchemy.pool.QueuePool:Connection <connection object at 0x2d7db10;
dsn: 'dbname=zarp', closed: 0> rollback-on-return
DEBUG:sqlalchemy.pool.QueuePool:Closing connection <connection object at
0x2d7db10; dsn: 'dbname=zarp', closed: 0>
DEBUG:sqlalchemy.pool.QueuePool:Connection <connection object at 0x2dbb390;
dsn: 'dbname=zarp', closed: 0> checked out from pool
--
Jon Nelson
Dyn / Principal Software Engineer
p. +1 (603) 263-8029
--
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 https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.