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

ASF GitHub Bot commented on AMQ-6391:
-------------------------------------

GitHub user pdudits opened a pull request:

    https://github.com/apache/activemq/pull/197

    https://issues.apache.org/jira/browse/AMQ-6391

    Test case for multiple connections participating in one phase commit,
    causing leak in ConnectionStateTracker.
    
    Keep all the connections participating in an transaction in a static 
multimap
    similar to the one in TransactionContext.
    
    Even though Garry  says that static fields may cause issues in OSGi, I am 
offering this as a solution. This static map has same lifecycle, classloading 
and  source bundle as the one already present in TransactionContext, therefore 
I assume it cannot really make things worse.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/pdudits/activemq amq-6391

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/activemq/pull/197.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #197
    
----
commit 1c36bac35f7ad9ccb4b7dd9f981dc915e78947ea
Author: Patrik Dudits <[email protected]>
Date:   2016-08-09T14:41:46Z

    https://issues.apache.org/jira/browse/AMQ-6391
    
    Test case for multiple connections participating in one phase commit,
    causing leak in ConnectionStateTracker.
    
    Keep all the connections participating in an transaction in a static 
multimap
    similar to the one in TransactionContext.

----


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

Reply via email to