I have an accounting system in which I try to create transactions at high concurrency (load testing). This results in getting error SequelizeDatabaseError: ER_LOCK_DEADLOCK: Deadlock found when trying to get lock; try restarting transaction from the database (mysql). As per MySQL it is an expected error, but I am observing a unique behavior in this situation:
- The connections to database doesn't get closed after such a deadlock. MySQL
show processlist
shows these connections stuck in insert/update queries. - These connections doesn't get closed for long long time.
- My application timesout getting connection to database for further requests on.
- It fails to work afterwards for long long time.
Why is this happening? Ideally Sequelize should close the connection if it gets into an error right? Is this a bug with Sequelize?