You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by Nitin Shah <ns...@btisystems.com> on 2012/10/08 22:10:27 UTC

Broker repeating messages

Hi,

We are running Qpid C++ broker(s) release version 0.18 . I find it strange when the clients reconnect to a broker that has been killed and restarted, messages get repeated. In my case we set up the connection with the option = "reconnect:true". We also acknowledge the received messages as soon as they are received. In my test case, the messages are received a long time before the broker is killed and restarted. However, the last 5 messages are re-received whatever I do. The receiver Capacity is set to 10.

Can we avoid this situation. We wish not to get the repeated messages since we have already acknowledged them. Is this a BUG?

Nitin
[cid:image001.png@01CDA56C.ED6A4C70]


Re: Broker repeating messages

Posted by Gordon Sim <gs...@redhat.com>.
On 10/11/2012 02:52 PM, Nitin Shah wrote:
> Hi Gordon,
>
> Thanks for your responses to both my questions. The receive side i.e.
> that does the getNextReceiver() call and then fetches the message
> does a session acknowledge as soon as the fetch returns.
>
> The strange thing about my setup is that the sender is one thread on
> a process ( linux) and the receiver is another thread on the same
> process, so the data path is Process A to Broker via the Qpid Library
> ( I assume ) and then back to Process A. In my testing, the sends are
> done for 20 packets and then stop and no more sends are done.

Right, your application does no more sends, but if the library 
reconnects might it be resending any  of these that are in doubt?

One way to rule that out is to do a Session::sync() in your test after 
the last message is sent.

> I see
> that the receiver has received them and displayed the content for my
> validation. Then I go in and kill the broker and in our system a
> backup broker is started automatically. All users reconnect
> automatically and the last 5 messages are received by the receiver in
> Process A again. It does not matter how long I wait after the sends
> are complete, may be minutes and it still repeats the messages.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org


RE: Broker repeating messages

Posted by Nitin Shah <ns...@btisystems.com>.
Hi Gordon,

Thanks for your responses to both my questions. The receive side i.e. that does the getNextReceiver() call and then fetches the message does a session acknowledge as soon as the fetch returns.  

The strange thing about my setup is that the sender is one thread on a process ( linux) and the receiver is another thread on the same process, so the data path is Process A to Broker via the Qpid Library ( I assume ) and then back to Process A. In my testing, the sends are done for 20 packets and then stop and no more sends are done. I see that the receiver has received them and displayed the content for my validation. Then I go in and kill the broker and in our system a backup broker is started automatically. All users reconnect automatically and the last 5 messages are received by the receiver in Process A again. It does not matter how long I wait after the sends are complete, may be minutes and it still repeats the messages.


I have not tried the senders and receivers on different processes. I will and I suspect that may work.

Hope this helps

Nitin



-----Original Message-----
From: Gordon Sim [mailto:gsim@redhat.com] 
Sent: Thursday, October 11, 2012 3:02 AM
To: dev@qpid.apache.org
Subject: Re: Broker repeating messages

On 10/08/2012 09:10 PM, Nitin Shah wrote:
> We are running Qpid C++ broker(s) release version 0.18 . I find it 
> strange when the clients reconnect to a broker that has been killed 
> and restarted, messages get repeated. In my case we set up the 
> connection with the option = "reconnect:true". We also acknowledge the 
> received messages as soon as they are received. In my test case, the 
> messages are received a long time before the broker is killed and 
> restarted. However, the last 5 messages are re-received whatever I do. 
> The receiver Capacity is set to 10.
>
> Can we avoid this situation. We wish not to get the repeated messages 
> since we have already acknowledged them. Is this a BUG?

Once an acknowledgement has been processed by the broker it should not redeliver those messages. On linux there is a known issue at present relating to the asynchronous write of the dequeue record to the journal. 
The 0-10 session-completed for message-accept is sent without waiting for that asynchronous write to complete. This can mean that recently acknowledged messages are not marked as dequeued in the broker when it is shutdown, and those messages would be redelivered when restarted.

However, it does seem strange that it is a 'long time' before the broker is killed that the acknowledgements were sent. Can you quantify what you mean there?

One other thing to check is to make sure that it is not in fact the sender that is replaying the messages (rather than the broker).


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org


Re: Broker repeating messages

Posted by Gordon Sim <gs...@redhat.com>.
On 10/08/2012 09:10 PM, Nitin Shah wrote:
> We are running Qpid C++ broker(s) release version 0.18 . I find it
> strange when the clients reconnect to a broker that has been killed and
> restarted, messages get repeated. In my case we set up the connection
> with the option = “reconnect:true”. We also acknowledge the received
> messages as soon as they are received. In my test case, the messages are
> received a long time before the broker is killed and restarted. However,
> the last 5 messages are re-received whatever I do. The receiver Capacity
> is set to 10.
>
> Can we avoid this situation. We wish not to get the repeated messages
> since we have already acknowledged them. Is this a BUG?

Once an acknowledgement has been processed by the broker it should not 
redeliver those messages. On linux there is a known issue at present 
relating to the asynchronous write of the dequeue record to the journal. 
The 0-10 session-completed for message-accept is sent without waiting 
for that asynchronous write to complete. This can mean that recently 
acknowledged messages are not marked as dequeued in the broker when it 
is shutdown, and those messages would be redelivered when restarted.

However, it does seem strange that it is a 'long time' before the broker 
is killed that the acknowledgements were sent. Can you quantify what you 
mean there?

One other thing to check is to make sure that it is not in fact the 
sender that is replaying the messages (rather than the broker).


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org