HI,
I am using sqlalchemy version 1.4.51 and zope version 5.8.3, seeing that there is a connection busy issue, when i use sqlalchemy with zope in a multi threaded environment.
I use Products.sqlalchemy.da library, which gives me the same thread local session, when i inspect using this line session.bind.pool.status
Pool size: 20 Connections in pool: 0 Current Overflow: -19 Current Checked out connections: 1 --> on multi threaded environment the checked out connection is always remains as 1.
Installed library:
zope --> 5.8.3
sqlalchemy --> 1.4.51
Products.Sqlalchemy.da --> 2.2
z3c.sqlalchemy --> 2.1.1
zope.sqlalchemy --> 3.1
pyodbc --> 4.0.35
mssql --> ODBC 17 driver.
Traceback:
Module sqlalchemy.orm.query, line 2824, in first
Module sqlalchemy.orm.query, line 2916, in _iter
Module sqlalchemy.orm.session, line 1717, in execute
Module sqlalchemy.engine.base, line 1710, in _execute_20
Module sqlalchemy.sql.elements, line 334, in _execute_on_connection
Module sqlalchemy.engine.base, line 1577, in _execute_clauseelement
Module sqlalchemy.engine.base, line 1953, in _execute_context
Module sqlalchemy.engine.base, line 2134, in _handle_dbapi_exception
Module sqlalchemy.util.compat, line 211, in raise_
Module sqlalchemy.engine.base, line 1910, in _execute_context
Module sqlalchemy.engine.default, line 736, in do_execute
sqlalchemy.exc.DBAPIError: (pyodbc.Error) ('HY000', '[HY000] [Microsoft][ODBC Driver 17 for SQL Server]Connection is busy with results for another command (0) (SQLExecDirectW)')
Is there anything i need to look upon,
code:
from Products.SQLAlchemyDA.da import lookup_sa_wrapper
wrapper = lookup_sa_wrapper('name') --> name is the key it returns z3c.sqlalchemy wrapper
session = wrapper.session
Could you please help here.