caminte
caminte copied to clipboard
Transaction MySQL
Using the MySQL adapter with the option "pool" set to true if 2 or more transactions are executed in rapid succession even if the callbacks don't report any errors the database connections are not correctly released and the client becomes unusable. With unsuable i mean that the next query won't be able to get any result because it will stay in a "pending" state.
The problems seems to occur because, when using pool
set to true
, caminte will use all the available connections to launch begin / revert / commit
.
If all your connections are already used it won't be able to complete the transactions.
You can bypass the problem by setting pool
to false
.
Otherwise, while waiting for a fix, you can use two caminte instances, one with pool
to true
for all the common queries and the other one with pool
to false
for the transactions.
Caminte MySQL adapter, on transactions, is not following the default behaviour: https://github.com/mysqljs/mysql#transactions
Right now caminte is using a different connection for each query in the transaction: https://github.com/biggora/caminte/blob/b662a3e2f18861dd4c18ba772a89998870d44fd6/lib/adapters/mysql.js#L128
Caminte should be forced to use the same connection in the same transaction.
alternatively is there a way to forcibly remove the session/end transaction?? I'm having the same issue even when I flip it to false for pool. Right now it just stalls out and my app hangs.