You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found an unexpected behavior regarding the companion object in TransactionManager, that I think might be a bug.
How to reproduce:
Call Database.connect(dataSource)
Call transaction(db, statement) – this will result in the inTopLevelTransaction(...) function being called which ends with a TransactionManager.resetCurrent(null) call.
Call TransactionManager.closeAndUnregister(database) (the one that was returned from step 1.)
Call Database.connect(dataSource) a second time for a new dataSource
Now, TransactionManager.manager will return the initial NotInitializedManager instance, instead of the transaction manager that was created during step 4.
That is because inside the closeAndUnregister function in step 3., a value is removed from managers, afterwards the current transaction manager is calculated using managers.first which returns the bottom NotInitializedManager. Therefore currentThreadManager.remove() is not called and the current thread manager stays incorrect.
A workaround is calling TransactionManager.resetCurrent(null) right after step 3.
The text was updated successfully, but these errors were encountered:
Hi,
I found an unexpected behavior regarding the companion object in
TransactionManager
, that I think might be a bug.How to reproduce:
Database.connect(dataSource)
transaction(db, statement)
– this will result in theinTopLevelTransaction(...)
function being called which ends with aTransactionManager.resetCurrent(null)
call.TransactionManager.closeAndUnregister(database)
(the one that was returned from step 1.)Database.connect(dataSource)
a second time for a newdataSource
Now,
TransactionManager.manager
will return the initialNotInitializedManager
instance, instead of the transaction manager that was created during step 4.That is because inside the
closeAndUnregister
function in step 3., a value is removed frommanagers
, afterwards the current transaction manager is calculated usingmanagers.first
which returns the bottomNotInitializedManager
. ThereforecurrentThreadManager.remove()
is not called and the current thread manager stays incorrect.A workaround is calling
TransactionManager.resetCurrent(null)
right after step 3.The text was updated successfully, but these errors were encountered: