[jboss-user] [JBoss Messaging] - Re: Memory Leak with EJB3 ?

dunks80 do-not-reply at jboss.com
Fri Jan 26 13:42:03 EST 2007


JBoss 4.0.5.GA
JBoss Messaging 1.0.1
Jboss TS 4.2.2
MS-SQL 2000 w/jtds driver

I'm seeing the same problem. Tenured gen is filling up with org.jboss.jms.tx.TxState and org.jboss.jms.tx.LocalTx when processing messages using an EJB3 MDB. I am debugging through the org.jboss.jms.tx.MessagingXAResource and here is what I'm seeing...

In public void start(Xid xid, int flags) throws XAException A new TxState is put into the ResourceManager's map of transactions.

In public void end(Xid xid, int flags) throws XAException Another new TxState is put into the map of transactions b/c of the call to unsetCurrentTransactionId.

  |   // Don't unset the xid if it has previously been suspended.  The session could have been
  |       // recycled
  |       if (xid.equals(sessionState.getCurrentTxId()))
  |       {
  |          sessionState.setCurrentTxId(rm.createLocalTx());
  |       }
  | 
which is called no matter what the outcome of the transaction based on this code...

  | public void end(Xid xid, int flags) throws XAException
  |    {
  |       if (trace) { log.trace(this + " ending " + xid + ", flags: " + flags); }
  | 
  |       synchronized (this)
  |       {
  |          switch (flags)
  |          {
  |             case TMSUSPEND :
  |                unsetCurrentTransactionId(xid);                             
  |                rm.suspendTx(xid);
  |                break;
  |             case TMFAIL :
  |                unsetCurrentTransactionId(xid);
  |                rm.endTx(xid, false);
  |                break;
  |             case TMSUCCESS :
  |                unsetCurrentTransactionId(xid);
  |                rm.endTx(xid, true);
  |                break;
  |          }
  |       }
  |    }
  | 
I'm not by any means an expert in the TX code...but this unsetCurrentTransactionId seems to be what's causing the problem...the xid is always equal to the currentTxId so a new TxState is added to the ResourceManager's map of transactions. Is this correct? Why? This results in two TxState objects being put into the transaction map for each transaction...and only one gets removed when commit is called...causing the heap to grow. 


In public void commit(Xid xid, boolean onePhase) throws XAException the first TxState is removed from the map of transactions.

Is there something I've done wrong to cause this behavior? TransactionAttribute settings? Some setting in JBoss Messaging? Of is this a genuine bug?


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4006965#4006965

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4006965



More information about the jboss-user mailing list