Uploaded image for project: 'EJB Client Library (AS7+)'
  1. EJB Client Library (AS7+)
  2. EJBCLIENT-125

TransactionInterceptor registers new XAResource for each bean method invocation in server transaction context

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 4.0.0.Beta25
    • 2.0.1.Final
    • None
    • Hide

      A reproducible test case is prepared - it's a simple ear-application with sources: https://yadi.sk/d/-ODfqVnOdaFdx
      Instructions to run the test case are provided in included readme.txt.

      Show
      A reproducible test case is prepared - it's a simple ear-application with sources: https://yadi.sk/d/-ODfqVnOdaFdx Instructions to run the test case are provided in included readme.txt.

    Description

      If EJB is called in context of server transaction, then new XAResource is created and enlisted in transaction for each bean method call in following methods sequence:
      TransactionInterceptor.handleInvocation->EJBClientManagedTransactionContext.getAssociatedTransactionID.

      Actually, only the first EJBClientManagedTransactionContext$ResourceImpl object is registered as resource in transaction and all other objects find their way in '_duplicateResources' – because each new ResourceImpl object doesn't has equals/hashCode methods overloaded, so TransactionImple consider it as a new object, however its 'isSameRM' returns 'true' when compared to previous object, so 'start' method with JOIN option is called for this new object and it's added to '_duplicateResources' list.

      As result of such behavior a lot of memory may be consumed if application performs many ejb calls to collocated beans, which can lead to OutOfMemoryError and noticeable performance degradation.

      Screenshots from Memory Analyzer:
      http://ic.pics.livejournal.com/lerm_ru/7464985/138367/138367_1000.png
      http://ic.pics.livejournal.com/lerm_ru/7464985/138609/138609_1000.png

      Attachments

        Activity

          People

            dlloyd@redhat.com David Lloyd
            alexeymakhmutov Alexey Makhmutov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: