Apache commons GenericObjectPool

In a Spring MVC project I have inserted the GenericObjectPool of Apache commons. This library has done what it should for several months, until the visitor counts reached a big number. Since this time, the Jetty server breaks down with heapspace exhausted.

After analysing the heapdumps I found out, that the server after running about 2 hours included ca. 600.000 Objects of the GenericObjectPool in it’s memory which will not be destroyed. commons-dbcp as maven dependency is available in it’s actual stable version 1.4. Poorly this library includes the commons-pool in the version 1.5.4, which includes the known bug from version 1.5, where the factory methods are removed from the synconized scope to prevent deadlocks. This fix had the result, that the connections are not destroyed correctly anymore. This is resolved in the commons-pool version 1.5.5, but the stable version of commons-dbcp does not include it.

This Problem can be resolved by the following entries in the POM file:

    <!-- Exclude Commons Pool 1.5.4 because using a newer version -->

Simply exclude the version 1.5.4 of commons-pool and import the newest stable version of commons-pool (actually version 1.6) single. This resolves the problem with unclosed connections.

Print Friendly

One thought on “Apache commons GenericObjectPool

  1. Agentur Typo3 Programmierung at Steilstarter


    This is great work. I really need this code because I have issue and need help. So now I can easily solve my problem.



Leave a Reply

Your email address will not be published. Required fields are marked *