Add failing tests to reproduce POOL-413 #453
Open
+73
−0
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.
Thanks for your contribution to Apache Commons! Your help is appreciated!
Before you push a pull request, review this list:
mvn; that'smvnon the command line by itself.In a
GenericObjectPoolit is possible to configure a maximum number of idle objects to be kept by the pool while they are not in use.In unfortunate circumstances, if several threads return an object to the pool at the same time, the check on the maximum number of idle objects may be dismissed. This results in the pool keeping more idle objects than configured.
Looking into the source code of the
returnObjectmethod of theGenericObjectPool, it seems that there is no synchronization between the moment the check is made for themaxIdleconfiguration and the moment the object is destroyed:The PR contains the test to demonstrate the failure. A fix is ready for the same. Once the maintainer confirm the bug, a seperate PR for the fix will be raised.