-
Notifications
You must be signed in to change notification settings - Fork 693
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug when calling TransactionManager.closeAndUnregister
from a different Thread
.
#1387
Comments
I guess the problem here is a missing synchronization as with your fix you'll get |
Can you please check your case with code from master before I'll release it? |
@Tapac yes, I can! Thanks for the quick response. |
@Tapac the fix on master didn't work. I also added a test in the PR, and added some comments to what is causing the issue. |
@nomisRev, I found a bug (thanks for your test) can you please verify on master? |
@Tapac, tested and this fixes the bug! Thanks for solving so fast 🙌 |
I think the |
I encountered a bug when using a custom wrapped
TransactionManager
and callingcloseAndUnregister
from a different thread. In this case a testing framework is closing the instance of Exposed, so I don't have any control over the caller ofAutoCloseable#close
.The following snippet reproduces the bug:
What is going wrong here is all happening in
closeAndUnregister
.We call it from a new thread so the
internal val currentThreadManager
is uninitialised.Right before there is a call to
ThreadLocal#initialValue
we clear the value fromregisteredDatabases
insideTransactionManager
leading to theIllegalStateException
.The text was updated successfully, but these errors were encountered: