Uploaded image for project: 'Commons Pool'
  1. Commons Pool
  2. POOL-212

GenericObjectPool allows maxIdle < minIdle

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.4
    • Fix Version/s: 1.5.8, 1.6.1, 2.0
    • Labels:
      None

      Description

      GenericObjectPool allows any values for minIdle and maxIdle, and performs no validation on those values.
      It allows maxIdle to be less than minIdle, and that creates weird behavior during eviction.
      After each eviction the Evictor thread calls ensureMinIdle() method which adds objects the pool using addObjectToPool() to make sure there at least minIdle objects in the pool.addObjectToPool() on another hand makes sure that there no more then maxIdle objects in the pool, and immediately destroys the newly created object.

      In my application we had minIdle configured to 100, but maxIdle wasn't configured and used the default value which is 8, and each eviction would create and destroy a bunch of objects.

      This issue can be fixed by adding checks in setMinIdle and setMaxIdle, or by adding maxIdle variable to the formula used in calculateDevicit() method.

      We use version 1.4, but I also tested it on latest 1.6 and observed the same behavior.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              serega Sergejs Melderis
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: