Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-4569

EntityBean instances are leaked from pool on certain exceptions

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 9.0.0.CR2, 10.0.0.Alpha1
    • 8.2.0.Final, 9.0.0.Beta2, 9.0.0.CR1
    • EJB
    • None

    Description

      Entity beans instances may not be returned to the pool after certain exceptions, which may lead to pool exhaustion.

      Currently, following two cases are discovered:

      1. If any exception is thrown from ejbCreate method (e.g. duplicate record was found in the database), then bean instance won’t be returned to the pool, as there are no try-finally statements around call to ejbCreate in EntityBeanEjbCreateMethodInterceptor/EntityBeanRemoteViewInstanceFactory classes for this call.
      2. If runtime exception (such as EJBException) is thrown from business method, then instance won’t be returned to the pool, as it will be marked as discarded by EntityBeanAssociatingInterceptor and both ReferenceCountingEntityCache/TransactionLocalEntityCache cache implementations just ignores discarded instance on release call.

      These problems actually make impossible using of pooled instances with Entity beans, as number of used beans from pool will be steadily increasing in production until pool is exhausted and clients start getting ‘Failed to acquire permit’ exceptions.

      Here is the set of integration tests, which examines the described behavior: https://github.com/Lerm/jboss-as/commit/f3eadd96d84dabc0a8b9c6c866ccfd5fe52720fd

      Attachments

        Activity

          People

            alexeymakhmutov Alexey Makhmutov
            alexeymakhmutov Alexey Makhmutov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: