summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/testing
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2021-02-22 21:49:09 -0500
committermike bayer <mike_mp@zzzcomputing.com>2021-02-25 20:49:52 +0000
commita5b76f7b07e620ece882137ceb51bace3898fad5 (patch)
tree03aac63d2e9af851a317503e577e6bea2ff35793 /lib/sqlalchemy/testing
parentdc615763d39916e9c037c7c376db1817cdf02764 (diff)
downloadsqlalchemy-a5b76f7b07e620ece882137ceb51bace3898fad5.tar.gz
mutex asyncpg / aiomysql connection state changes
Added an ``asyncio.Lock()`` within SQLAlchemy's emulated DBAPI cursor, local to the connection, for the asyncpg dialect, so that the space between the call to ``prepare()`` and ``fetch()`` is prevented from allowing concurrent executions on the connection from causing interface error exceptions, as well as preventing race conditions when starting a new transaction. Other PostgreSQL DBAPIs are threadsafe at the connection level so this intends to provide a similar behavior, outside the realm of server side cursors. Apply the same idea to the aiomysql dialect which also would otherwise be subject to corruption if the connection were used concurrently. While this is an issue which can also occur with the threaded connection libraries, we anticipate asyncio users are more likely to attempt using the same connection in multiple awaitables at a time, even though this won't achieve concurrency for that use case, as the asyncio programming style is very encouraging of this. As the failure modes are also more complicated under asyncio, we'd rather not have this being reported. Fixes: #5967 Change-Id: I3670ba0c8f0b593c587c5aa7c6c61f9e8c5eb93a
Diffstat (limited to 'lib/sqlalchemy/testing')
0 files changed, 0 insertions, 0 deletions