[
https://issues.apache.org/jira/browse/AMQ-6391?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15413739#comment-15413739
]
Gary Tully commented on AMQ-6391:
---------------------------------
[~pdudits] having a unit test is a great start :-)
This use case make me thing that tracking transactions by the failover
transport is not such a good idea. Maybe an alternative approach is to allow
that option to be disabled. It is is always on at the moment, see:
https://github.com/apache/activemq/blob/31c55f75108b06020eb6206c52361b04f49656a9/activemq-client/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java#L134
If the connection/transaction dies, the mdb can rollback the onMessage.
If you are using failover just for discovery or loadbalancing, and use
something like maxReconnectAttempts=0, there would be no recovery of the
failover transport and it would not make any sense to track transactions.
> 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
> Attachments: 0001-AMQ-6391-test.patch
>
>
> 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)