[ 
https://issues.apache.org/jira/browse/AMQ-6391?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15413541#comment-15413541
 ] 

Patrik Dudits commented on AMQ-6391:
------------------------------------

Thanks Gary,

yes, moving to {{useInboundSession}} is indeed what we are going to do in the 
meantime. 

The connections are getting xa-end, just the commit is reaching only the 
topmost one. If it is OK for broker to receive commit command for single 
transaction from multiple connections, then the solution appears to be easy - 
[afterCommit|https://github.com/apache/activemq/blob/a65f5e7c2077e048a2664339f6425d73948d71ce/activemq-client/src/main/java/org/apache/activemq/TransactionContext.java#L596]
 is fired for all participating transaction contexts already, they just need to 
send the transaction info if they already didn't.

I'll see if I can build a testcase for this, and can try this approach.

And for reference, I originally asked this on user mailing list: 
http://activemq.2283324.n4.nabble.com/Messages-piling-up-in-FailoverTranport-td4715072.html

> Memory leak with FailoverTransport when sending TX messages from MDB
> --------------------------------------------------------------------
>
>                 Key: AMQ-6391
>                 URL: https://issues.apache.org/jira/browse/AMQ-6391
>             Project: ActiveMQ
>          Issue Type: Bug
>            Reporter: Patrik Dudits
>
> We observe memory leak in 
> {{FailoverTransport.stateTracker.connectionStates.transactions}} when using 
> XA Transactions in activemq-rar, sending message within same transaction and 
> not using {{useInboundSession}}.
> In such constellation there are two connections enlisted within same 
> transaction. During commit the transaction manager will execute commit on one 
> of the resources, per JTA 1.2 section 3.3.1 ("(TransactionManager) ensures 
> that the same resource manager only receives one set of prepare-commit calls 
> for completing the target global transaction ".) 
> [TransactionContext|https://github.com/apache/activemq/blob/a65f5e7c2077e048a2664339f6425d73948d71ce/activemq-client/src/main/java/org/apache/activemq/TransactionContext.java#L478]
>  will propagate the afterCommit to all contexts participating in same 
> transaction. However, this is not enough for {{ConnectionStateTracker}}, 
> which only reacts to [TransactionInfo 
> command|https://github.com/apache/activemq/blob/a65f5e7c2077e048a2664339f6425d73948d71ce/activemq-client/src/main/java/org/apache/activemq/TransactionContext.java#L469].
>  In effect, when two connection are enlisted in same transaction, just 
> commands of one of them is cleared upon commit, leading to memory leak.
> Since I presume the {{TransactionInfo}} should be sent only once for commit 
> of single transaction, {{ConnectionStateTracker}} needs to clear state for 
> the acknowledged transactions regardless of connection id in the transaction 
> command.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to