You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "Gary Tully (JIRA)" <ji...@apache.org> on 2016/08/09 13:30:20 UTC

[jira] [Commented] (AMQ-6391) Memory leak with FailoverTransport when sending TX messages from MDB

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

Gary Tully commented on AMQ-6391:
---------------------------------


This is a little problematic. N connections in a tx need some coordination and avoiding the N using useInboundSession is the simplest approach.
An alternative approach is to force 2pc using connection url param rmIdFromConnectionId=true.

In that way, each connection gets an xa-end and can force an sync with the broker. The end/sync is important to be sure that all work is visible to the broker before the prepare/commit call (on one of the connections).

Without that, for an ack, there is no way to know that the broker has got the command before the commit/prepare
For sends, there is alwaysSyncSend, which should work (I think) but for acks there is no such option at the moment.

This all points to the need to do transaction completion on each connection, which would avoid this leak.



> 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)