Uploaded image for project: 'Application Server 3  4  5 and 6'
  1. Application Server 3 4 5 and 6
  2. JBAS-8367

BasePool.emptySubPool() shuts down non-idle pool

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 6.0.0.M5
    • JBossAS-5.1.0.GA
    • JCA service
    • None

      org.jboss.resource.connectionmanager.BasePool.emptySubPool() will shut down the per-subject or per-criteria subpool if it is idle, following the change in JBAS-5929 to reduce memory usage.

      It determines if the sub-pool is idle by using isEmpty(), however that only checks whether there are connections in the pool and does not look at checked out connections. So if all the connections from a pool are checked out, it will be shut down and the in-use connections destroyed when they are returned.

      This can manifest as a problem if a connection if during a transaction a 1PC resource is used twice, and the pool is shutdown before the second use because it has no connection that are not in use but have not reached the idle time.

      I haven't managed to produce a simple test case for this yet, however a complex application which triggers it right after the IdleRemover runs works correctly with any of these changes:
      1) On AS 5.0.0 (which doesn't have JBAS-5929) instead of 5.1.0
      2) Using datasource settings which mean it uses OnePool (which overrides emptySubPool to do nothing) instead of PoolBySubject

      To trigger it will require:
      1) PoolBySubject, PoolByCri or PoolBySubjectAndCri to be used
      2) an idle timeout set
      3) a 1 phase resource
      4) a transaction which uses that 1PC resource twice
      5) the idle timeout to run after the first getConnection() call but before the second.

      I believe that it should check whether there are any connections checked out and not shutdown the pool in that case since it is not idle.

        1. JBAS-8367.patch
          0.5 kB
          Jesper Pedersen

              jpederse@redhat.com Jesper Pedersen
              rhn-support-jlivings James Livingston (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: