fix: EXPOSED-133 Suspend transactions blocking Hikari connection pool #1837
+73
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
If the
maximumPoolSize
of aHikariDataSource
is exceeded, any active connections made throughnewSuspendedTransaction()
are not released back into the pool after job completion. This leads to a connection timeout exception when attempting to get more connections.resetIfClosed()
, invoked insuspendedTransactionAsyncInternal()
, callsgetConnection()
to check if a transaction is closed (may happen after a repetition attempt fails), so that it can be properly reset for another attempt. This blocks the connections being released.The function was introduced in PR #1774 and should not be necessary for the first loop, as the transaction is created with an open connection.
Now
resetIfClosed()
is only called on subsequent repetition attempt loops.Unit test:
exposed-tests
module.exposed-tests/build.gradle.kts
, before running the test provided in the original YT issue: