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

Fixes #23483 Add lock, add notifyWaitingThreads call for better max pool size logic. #24879

Merged
merged 2 commits into from Mar 30, 2024

Conversation

escay
Copy link
Contributor

@escay escay commented Mar 27, 2024

Fixes #23483 Add lock logic between 2 methods, add notifyWaitingThreads call for better max pool size logic.

Add lock, add notifyWaitingThreads call for better max pool size logic. No longer getResources while the pool is being resized. And inform waiting threads when resources are marked as failed.

See my analysis in #23483 for more information. Short version: getResource takes a connection from the pool, and resizes the pool when needed, while in the meantime another thread returns a resource to the pool, causing the resizePoolAndGetNewResource method to make the pool size too large. And in case of failing connections are being returned, the waiting threads are not informed, while they could ask for a fresh new connection from the pool.

Without the changes in ConnectionPool you should be able to reproduce the issues with the unit test. It might be needed to run the test several times, or increase the number of tasks in the test itself.

…better max pool

size logic.

Add lock, add notifyWaitingThreads call for better max pool size logic.
No longer getResources while the pool is being resized. And inform
waiting threads when resources are marked as failed.
…better max pool

size logic. Fix incorrect javadoc.
@dmatej dmatej added this to the 7.0.14 milestone Mar 28, 2024
@dmatej dmatej added bug Something isn't working code cleaning labels Mar 28, 2024
@dmatej dmatej requested a review from pzygielo March 30, 2024 11:47
@arjantijms arjantijms merged commit 5ecf0be into eclipse-ee4j:master Mar 30, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working code cleaning
Projects
None yet
Development

Successfully merging this pull request may close these issues.

It didn't reach the limit of max-pool-size, but there was an maxPoolSize exhausted exception
4 participants