[jbossseam-issues] [JBoss JIRA] Commented: (JBSEAM-3873) Memory leak using EJB transactions and jBpm contexts

Norman Richards (JIRA) jira-events at lists.jboss.org
Sun Apr 26 19:15:46 EDT 2009


    [ https://jira.jboss.org/jira/browse/JBSEAM-3873?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12464549#action_12464549 ] 

Norman Richards commented on JBSEAM-3873:
-----------------------------------------

I've spent some time looking at this and your analysis is correct.  EJBSynchronizations is in the event context.  In the JMS context, the seam event context only wraps the onMessage() invocation and sits INSIDE the the container management of the request, including TX management.  By the time the transaction is committed, the event context has been destroyed and Seam has destroyed the EJBSynchronization object, making the synchronization callbacks, which should do the jbpm context cleanup, fail.

There seem to be a couple of potential ways to solve this.  If we can prevent Seam from calling the remove method, everything works fine.  (minus the session bean that doesn't get removed).   I'm not sure how to make that happen in a generic way though...



> Memory leak using EJB transactions and jBpm contexts
> ----------------------------------------------------
>
>                 Key: JBSEAM-3873
>                 URL: https://jira.jboss.org/jira/browse/JBSEAM-3873
>             Project: Seam
>          Issue Type: Bug
>          Components: BPM, Core, EJB3
>    Affects Versions: 2.1.1.GA
>         Environment: JBoss 4.2.x, Mac OSX and Linux environments, Java 1.5
>            Reporter: Torsten Fink
>            Assignee: Norman Richards
>             Fix For: 2.1.2.CR2
>
>         Attachments: MemoryLeakEventKontext.tgz
>
>
> Our application had to survive a night with full load. On the next morning the heap was full of JbpmContext's. 
> After looking at the source code of Seam and at the debug messages we came up with this hypothesis: 
> * The SFSB EjbSynchronizations is placed in the event context, the Seam-JbpmContext-Component also lives in the event context. 
> * Using EJB transactions, EjbSynchronizations is responsible for cleaning up the JbpmContext after the end of the transaction. 
> * Unfortunately the event context ends BEFORE EjbSynchronizations has the chance to clean up the JbpmContext. 
> Using BMT the transaction ends before the event context ends. Thus, the JbpmContext is cleaned up. 
> We switch all our MDBs, EJB-timers, and Web-services from CMT to BMT and (after fixing some other leaks, e.g. a class loader issue in jBpm), we survived the night. 
> I wrote a small test application that shows the memory leak and I will try to attach it to this issue.
> It is a Maven application that consists of 
> - a Web-GUI to start the test and displays the results  (http://localhost:8080/leak/)
> - a SFSB that sends 10 messages each to two queues (the standard queues A and B), waits a little bit, and does a gc 
> - two MDBs, one with CMT, one with BMT, which uses Seam injection to access a jBpm-Context 
> - an application scoped POJO that saves the contexts in a Set using a weak reference 
> After executing the tests and the GC, the surviving references are displayed. You can see that the CMT references are not gs'ed whereas the BMT references are cleaned up. You can execute the test several times.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the seam-issues mailing list