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

Fix maxConnectionPoolSize verification #1216

Merged
merged 2 commits into from
Sep 3, 2024

Conversation

bigmontz
Copy link
Contributor

@bigmontz bigmontz commented Sep 2, 2024

Under high load of sessions, the connection pool is allowing new connections to be created.
This is happening because, while the development of AuthTokenManager and connection liveness check,
the methods do validate connection on acquired and return to the pool need to be async.
This changes creates a situation of racing condition which doesn't exist the original code and this introduces this bug.

Increasing the resouce acquired count before validating the connection solves the issue, since the race condition is removed. However, the pool needs also to release the resource when the validation return false or fails for some reason.
This is important to avoid broken connection still be count for the max pool size.

Copy link
Contributor

@MaxAake MaxAake left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 💯

Under high load of sessions, the connection pool is allowing new
connections to be created.
This is happening because, while the development of `AuthTokenManager`
and `connection liveness check`,
the methods do validate connection on acquired and return to the pool
need to be async.
This changes creates a situation of racing condition which doesn't exist
the original code and this introduces this bug.

Increasing the resouce acquired count before validating the connection
solves the issue, since the race condition is removed.
However, the pool needs also to release the resource when the validation
return `false` or fails for some reason.
This is important to avoid broken connection still be count for the max
pool size.

Co-Authored-By: Max Gustafsson <max.gustafsson@neo4j.com>
@bigmontz bigmontz force-pushed the fix-connection-pool-size branch from 2023922 to bd2f597 Compare September 3, 2024 07:22
The test were to tight and any slowness might cause the test to fail.
Increase the time waiting for the connection get release to pool reduces
the likehood of this problem happens.
@bigmontz bigmontz merged commit 720e5c6 into neo4j:5.0 Sep 3, 2024
37 checks passed
@bigmontz bigmontz deleted the fix-connection-pool-size branch September 3, 2024 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants