Commons Pool
  1. Commons Pool
  2. POOL-189

close() does not release threads blocked on borrowObject()

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.5.6
    • Fix Version/s: 1.5.7
    • Labels:
      None
    • Environment:

      java 1.6.0_24

      Description

      Hi,

      When I call close() and borrowObject() concurrently with no objects in
      the pool, close() will finish but borrowObject() is blocked forever.
      The documentation of close() mentions that borrowObject() should fail
      with IllegalStateException, so I would expect the waiting threads to
      throw IllegalStateException.

      I will attach a test that exposes this problem. For this test, the
      expected output is:
      0
      1
      2
      ...
      4999
      DONE

      But when the bug manifests (almost always for this test), the output
      is:
      0
      1
      2

      The test does not finish, it just gets stuck after printing several
      values.

      Is this a bug or am I reading the documentation wrongly? Is there
      a patch for this?

      Thanks!

      Adrian

      1. Test.java
        2 kB
        Adrian Nistor
      2. BUG-189v1.diff
        3 kB
        William R. Speirs
      3. BUG-189v2.diff
        6 kB
        William R. Speirs

        Activity

        Adrian Nistor created issue -
        Adrian Nistor made changes -
        Field Original Value New Value
        Attachment Test.java [ 12491676 ]
        Phil Steitz made changes -
        Fix Version/s 1.5.7 [ 12316353 ]
        William R. Speirs made changes -
        Attachment BUG-189v1.diff [ 12503627 ]
        William R. Speirs made changes -
        Attachment BUG-189v2.diff [ 12503752 ]
        Phil Steitz made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Phil Steitz made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Adrian Nistor
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development