On Monday, June 29, 2020 at 8:00:40 PM UTC-4, gbr wrote:
>
>
> I'm using SQLAlchemy's Core to interface a postgres database (via
> psycopg2) component alongside Flask-SQLAlchemy in a Flask app. Everything
> was working fine until I recently discovered what seems to be a deadlock
> state which is caused by two queries locking each other (at least that's my
> working hypothesis).
>
Beyond what Mike said... I don't use Flask but I use Pyramid and Twisted.
The only times I have experienced locking issues with SQLAlchemy:
* unit tests: the setup uses a first db connection, but it is erroneously
implemented and not closed. when test runners begin, the db is locked so
everything fails.
* application design issues: if you deploy a forking server and don't reset
the pool on fork (`engine.dispose()`), all sorts of integrity and locking
issues pop up (multiple processes try to use a single connection which
never closes properly). if you don't have a proper connection
checkout/return that can happen too.
* very high concurrency: a pileup of connections want to lock for
update/insert. inevitably, some timeout and deadlock.
--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper
http://www.sqlalchemy.org/
To post example code, please provide an MCVE: Minimal, Complete, and Verifiable
Example. See http://stackoverflow.com/help/mcve for a full description.
---
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to sqlalchemy+unsubscr...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/sqlalchemy/3981ffb7-611f-4a88-9058-a0e09ab60005o%40googlegroups.com.