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

Keith Wall edited comment on QPID-4171 at 7/29/12 1:02 PM:
-----------------------------------------------------------

#addFuture() is used by #enqueue() to arrange for the postTransactionAction to 
be executed as each store transaction is completed asynchronously by the 
commit-thread.

An optimisation in #addFuture means that an enqueue can 'jump-the-queue', and 
be enqueued before others that are already waiting in the future recorder list.

A problematic sequence would be:

1) Message 1 arrives from sender
2) AsyncAutoCommitTransaction.enqueue called, but as commit thread is running 
behind, so its enqueue action joins list of the future recorder.
3) Messages 2 arrives from sender
4) BDB commit thread catches up the backlog
5) AsyncAutoCommitTransaction.enqueue called but as the StoreFuture is already 
completed, its enqueue action is executed immediately so Message 2 is enqueued.
6) AMQProtocolEngine#complete calls receiveComplete() so Message 1 enqueue 
action is called.
7) Message 2 will be delivered to a Consumer before Message 1.



{code}
    private void addFuture(final StoreFuture future, final Action action)
    {
        if(action != null)
        {
            if(future.isComplete())
            {
                action.postCommit();
            }
            else
            {
                _futureRecorder.recordFuture(future, action);
            }
        }
    }
{code}




 

                
      was (Author: k-wall):
    #addFuture() is used by #enqueue() to arrange for the postTransactionAction 
to be executed as each store transaction is completed asynchronously by the 
commit-thread.

An optimisation in #addFuture means that an enqueue can 'jump-the-queue', and 
be enqueued before others that are already waiting in the future recorder list.

A problematic sequence would be:

1) Message 1 arrives from sender
2) AsyncAutoCommitTransaction.enqueue called, but as commit thread is running 
behind, so its enqueue action joins list of the future recorder.
3) Messages 2 arrives from sender
4) BDB commit thread catches up the backlog
5) AsyncAutoCommitTransaction.enqueue called but as the StoreFuture is already 
completed, its enqueue action is executed immediately so Message 2 is enqueued.
6) AMQProtocolEngine#complete calls receiveComplete() so Message 1 enqueue 
action is called.  


{code}
    private void addFuture(final StoreFuture future, final Action action)
    {
        if(action != null)
        {
            if(future.isComplete())
            {
                action.postCommit();
            }
            else
            {
                _futureRecorder.recordFuture(future, action);
            }
        }
    }
{code}




 

                  
> Messages from a non-transactional session can be enqueued out of order
> ----------------------------------------------------------------------
>
>                 Key: QPID-4171
>                 URL: https://issues.apache.org/jira/browse/QPID-4171
>             Project: Qpid
>          Issue Type: Bug
>          Components: Java Broker
>    Affects Versions: 0.16, 0.18, 0.19
>            Reporter: Keith Wall
>            Assignee: Keith Wall
>
> A defect in AsyncAutoCommitTransaction means that occasionally messages 
> delivered by a non-transactional JMS are seen to be enqueued out-of-order and 
> therefore delivered to a consumer out of the expected order.  
> It is this problem that underlies QPID-4014, although as I think this problem 
> is wider than ConflationQueues, I am raising this separately.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to