Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-2033

JdbcBinaryCacheStore.purgeInternal() - releaseConnection() should be called in finally block.

    XMLWordPrintable

Details

    Description

      A potential memory leak of pooled DB connections is present in JdbcBinaryCacheStore. Observe the catch and finally blocks of the purgeInternal() method. The pooled DB connection is not released unless an SQLException has been thrown. Contrast with JdbcStringBasedCacheStore.purgeInternal(), where the releaseConnection() is invoked in the finally block.

      When using a JdbcMixedCacheStore, I noticed a DB connection leak. It appeared that for every two connections being acquired, only one was being released. I believe it is down to the fact that the JdbcBinaryCacheStore inside the JdbcMixedCacheStore is not releasing its connections properly (i.e. in its finally block) whereas the JdbcStringBasedCacheStore is.

      I guess a workaround is to use only a JdbcStringBasedCacheStore, not a JdbcMixedCacheStore.

      Attachments

        Issue Links

          Activity

            People

              ttarrant@redhat.com Tristan Tarrant
              jimidy Jim Dunkerton (Inactive)
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: