XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Invalid
    • None
    • None
    • None
    • 10 Threads, Default Configuration

    Description

      Here is the use case:

      • 8 Threads
      • Each Thread needs 2 objects from a pool
      • Pool has limit: 8 objects (default for DBCP)
      • After receiving first object from a pool, Thread calls wait() method on GenericObjectPool, to get access to released object
      • All Threads are waiting... (deadlock)

      I found it by running simple test with Hibernate & Spring, Hibernate needs second Connection to retrieve primary key from a database in a separate context. Anyway, synchronize/wait/notify IS NOT a best practice (2006, May).

      org.apache.commons.pool.impl.GenericObjectPool.borrowObject() - line 810

      MISTAKE at http://jakarta.apache.org/commons/dbcp/configuration.html:
      maxActive = "The maximum number of active connections that can be allocated from this pool at the same time, or zero for no limit. "

      • should be -1 instead of 'zero for no limit'. However, it does not help if I need to limit number of objects in a pool...

      Weak docs are a bug also... please note time spending for troubleshooting such tricky deadlocks...

      Cheers,
      Fuad Efendi

      Attachments

        Issue Links

          Activity

            People

              sandymac Sandy McArthur Jr
              funtick Fuad Efendi
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: