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

GKOP: returnObject does not unblock threads waiting in borrowObject if maxIdle=0

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 2.4.2
    • 2.6.1
    • None

    Description

      If idle objects are disabled by maxIdle=0 a thread blocked in borrowObject is not notified if another thread returns an object.

      Attached is a unit test (327-maxIdle0-test.patch) that demonstrates the issue. I tried a similar test on GenericKeyedObjectPool as well which not seems to be affected by this issue.

      I also attached two possible solutions for this issue.
      The first (327-maxIdle0.patch) just notifies a potentially waiting thread in the affected returnObject code branch. (similar to POOL-240)

      The second (327-maxIdle0-alternativ.patch) checks for waiting threads every time an object get destroyed. But this may introduce undesired behavior in other functions. (like clear or evict)

      Attachments

        1. 327-maxIdle0.patch
          1 kB
          Paul Pazderski
        2. 327-maxIdle0-alternativ.patch
          2 kB
          Paul Pazderski
        3. 327-maxIdle0-test.patch
          2 kB
          Paul Pazderski

        Issue Links

          Activity

            People

              struberg Mark Struberg
              Paul Pazderski Paul Pazderski
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: