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

NPE when deregistering key at end of borrow

    XMLWordPrintableJSON

Details

    • Task
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.11.1
    • 2.12.0
    • None

    Description

      There is a potential for an NPE happening in the finally block of borrowObject:

      Caused by: java.lang.NullPointerException: Cannot invoke "org.apache.commons.pool2.impl.GenericKeyedObjectPool$ObjectDeque.getNumInterested()" because "objectDeque" is null
      	at org.apache.commons.pool2.impl.GenericKeyedObjectPool.deregister(GenericKeyedObjectPool.java:821)
      	at org.apache.commons.pool2.impl.GenericKeyedObjectPool.borrowObject(GenericKeyedObjectPool.java:507)
      	at org.apache.commons.pool2.impl.GenericKeyedObjectPool.borrowObject(GenericKeyedObjectPool.java:350) 
      

      From reading the code, it seems this could happen e.g. if a pool is concurrently cleared while a borrow is in progress.

      Not sure what a proper solution here would be. Maybe deregister should silently do nothing if poolMap.get(k) returns null?

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              rec Richard Eckart de Castilho
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: