]
Norman Richards commented on JBSEAM-3873:
-----------------------------------------
The problem with being in the event context is only that the remove method gets called.
When the container comes to fire the synchronization, it still knows about
EjbSynchronizations, but the bean has been removed and is skipped over. Not putting
EjbSynchronizations in any context works because the bean is still active when the tx
commits. However, then there is the problem of how to get that bean removed.
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.2.0
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: