Skip to content
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]: Successful concurrent transactions can exhaust the Hikari connection pool #42242

Open
buehlefs opened this issue Feb 28, 2024 · 3 comments
Labels
needTriage The issue has to be inspected and labeled manually Type/Bug userCategory/Compilation

Comments

@buehlefs
Copy link

Description

Successfull transactions can exhaust the HikariPool of connections when they are executed concurrently. The issue does not appear when the transactions are run sequentially in a while-true loop in a single thread.
Later transactions will then result in stacktraces like this after a long timeout:

error DatabaseError ("Error while executing SQL query: INSERT INTO hello VALUES ('test'). error while getting the connection for SQLClientConnector. HikariPool-1 - Connection is not available, request timed out after 30000ms..",errorCode=0,sqlState=null)

    callableName: execute moduleName: ballerinax.java.jdbc.1.Client fileName: client.bal lineNumber: 79
    callableName: dbTest moduleName: test.playground.0 fileName: main.bal lineNumber: 24
    callableName: checkForPanic moduleName: test.playground.0.TestTask fileName: main.bal lineNumber: 78
    callableName: execute moduleName: test.playground.0.TestTask fileName: main.bal lineNumber: 66

Steps to Reproduce

The issue should be reproducible with the test code in issue #41281
All transactions must commit normally to make the issue more likely to occur.

Affected Version(s)

Ballerina 2201.8.5 (Swan Lake Update 8)
Ballerina 2201.8.4

OS, DB, other environment details and versions

OS: Ubuntu 20.04 running inside WSL2

JDBC Connector used:

[[platform.java11.dependency]]
artifactId="sqlite-jdbc"
version="3.36.0.1"
groupId="org.xerial"

Related area

-> Compilation

Related issue(s) (optional)

No response

Suggested label(s) (optional)

No response

Suggested assignee(s) (optional)

No response

@buehlefs
Copy link
Author

buehlefs commented Jun 3, 2024

I can still reproduce this in Ballerina 2201.9.0
@dsplayerX is this issue being worked on?

@dsplayerX
Copy link
Contributor

Hi @buehlefs,

We believe this issue arose from the locking implemented to make transactions concurrent safe in this PR. The delayed release of these locks and concurrent requests could be causing the Hikari pool to be exhausted. We're currently searching for a method to address this issue.

@buehlefs
Copy link
Author

I can no longer reproduce this issue using Ballerina 2201.10.2 so it might have been fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needTriage The issue has to be inspected and labeled manually Type/Bug userCategory/Compilation
Projects
None yet
Development

No branches or pull requests

3 participants