connectionless execution causes TLConnection to stay open incorreclty in certain scenarios
Issue #3780
new
Somewhat related to https://bitbucket.org/zzzeek/sqlalchemy/issues/3779/threadlocal-engine-sometimes-doesnt.
All calls to .contextual_connect() return the same TLConnection object, however sometimes the caller wants a Connection with the should_close_with_result attr set to True on the connection (connectionless execution via engine.execute). So, if the TLConnection is initially created with close_with_result=False, then calls to engine.execute() will increment the __open_count counter while never calling .close() to decrement it.
Failing test:
def test_tlbind_close_conn(self):
e = create_engine(testing.db.url, strategy='threadlocal')
conn = e.contextual_connect()
e.execute('select 1').fetchall()
conn.close()
assert conn.closed
Comments (3)
-
repo owner -
repo owner -
repo owner - changed milestone to 1.4
lower priority, almost would prefer to deprecate threadlocal engine ...
- Log in to comment
have you worked around #3779 and this one? I'd like to target these at 1.2.