[Sqlalchemy-tickets] Issue #3527: Possible Connection Leak? (zzzeek/sqlalchemy)
Brought to you by:
zzzeek
|
From: Tim M. <iss...@bi...> - 2015-09-10 02:56:39
|
New issue 3527: Possible Connection Leak? https://bitbucket.org/zzzeek/sqlalchemy/issues/3527/possible-connection-leak Tim Mitchell: SQLA 1.0.8 I am trying to debug an inexplicable 'connection unexpectedly closed' error when I run a test suite (with lots of engine.dispose()s). When I came across this. Given a pretty normal query in a ThreadLocal session and a QueuePool ``` #!python with db_context() as session: session.query(tables.Attachment).get(attachment_id) ``` When I look at the callstack for a new connection I see this: ``` #!python ... Query._connection_from_session(..., close_with_result=True) Session._connection_for_bind(..., kw={close_with_result=True)) SessionTransaction._connection_for_bind(...) # close_with_result NOT passed Engine.contextual_connect(..., close_with_result=False) ... # Create DBAPI connection ``` Specifying a NullPool makes everything work fine. |