Details
-
Bug
-
Resolution: Done
-
Major
-
2.0.1.Final
-
None
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