Open
Description
Hi,
We are experiencing an exception occurring after we implemented a recycle for DB connections in case of SQL error.
we use a DB connection from the pool this way:
try:
cnx_ref = None
async with dbPool.acquire() as conn:
cnx_ref = conn
async with conn.cursor() as cur:
await cur.execute(sql, args)
res = await cur.fetchall()
"""
some logic
"""
except:
if cnx_ref is not None:
await cnx_ref.close()
dbPool.release(cnx_ref)
And here is the exception we get:
async with dbPool.acquire() as conn:
File "/usr/local/lib/python3.7/site-packages/aiomysql/utils.py", line 98, in __aenter__
self._conn = await self._coro
File "/usr/local/lib/python3.7/site-packages/aiomysql/pool.py", line 135, in _acquire
await self._fill_free_pool(True)
File "/usr/local/lib/python3.7/site-packages/aiomysql/pool.py", line 151, in _fill_free_pool
if conn._reader.at_eof() or conn._reader.exception():
AttributeError: 'NoneType' object has no attribute 'at_eof'
Is there any solution around this ? Or are we handling things the wrong way ?
Activity