-
Notifications
You must be signed in to change notification settings - Fork 195
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
Kotlin Suspend @Transactional Function Issue #2949
Comments
Your project is not accessible. Please integrate test-resources for your tests so no docker commands are needed. |
Sorry, I thought it was public already, that's fixed now 👍 Regarding integrating |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Expected Behavior
When an exception that extends
kotlin.Throwable
is thrown in a Kotlin suspend function, the transaction should be rolled back and the connection should be properly released back to the connection pool.This would allow other transactions to use the connection and prevent potential resource leaks or deadlocks. The code block that is not being reached should be executed, ensuring that the transaction is either committed if no exceptions occurred, or rolled back if an exception was thrown.
In a nutshell, in the
io.micronaut.transaction.async.AsyncUsingSyncTransactionOperations.withTransaction
function, this part of the code should be reached:Actual Behaviour
Micronaut Data fails to evict an active connection when a @transactional suspend function throws an exception extending Throwable, resulting in a new connection being opened for each subsequent request
Steps To Reproduce
./gradlew -i test --rerun-tasks --tests "com.example.DemoTest.hikariIssue"
"Unexpected Exception: io.micronaut.http.client.exceptions.ReadTimeoutException: Read Timeout"
kotlin.Throwable
in a suspend function causes the transaction to be rolled back, but the connection is not released back to the poolEnvironment Information
Example Application
https://github.com/uberall/mn-kotlin-transactional-issue
Version
4.4.2
The text was updated successfully, but these errors were encountered: