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

GenericObjectPool.borrowObject() incorrectly swallows InterruptedException

    Details

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

      mac osx 10.5.8 jdk 1.6.0_22

      Description

      I just updated from commpons-pool 1.5.4 to 1.5.5 and suddenly some of my tests crash with threads hanging.

      After some inspection is appears that GenericObjectPool.borrowObject() no longer handles InterruptedException correctly. I made a file diff and found that there has been a modification in that area that contains the bug. See attached image.

      I have created a patched version absed on 1.5.4 source which works correctly in my use case. The important part is:

      catch (final InterruptedException e)
      {
         synchronized (this)
         {
            if (latch.getPair() == null)
            {
               _allocationQueue.remove(latch);
            }
            else
            {
               _numInternalProcessing--;
               _numActive++;
               _allocationQueue.remove(latch);
               returnObject(latch.getPair().value);
            }
         }
         Thread.currentThread().interrupt();
         throw e;
      }
      

        Attachments

          Activity

            People

            • Assignee:
              markt Mark Thomas
              Reporter:
              axelgr74 Axel Großmann
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: