[rabbitmq-discuss] Problem with c# client ModelBase.ConfirmSelect()

Robert Higgins RHi at np6.com
Fri Feb 28 10:07:16 GMT 2014


Hello,

I've encountered a problem with confirmed publishes in the c# client library. Basically, you cannot enable publish confirms via ConfirmSelect() more than one time on the same channel. If you do, you risk losing track of the publish acknowledgements.

Why you would want to call ConfirmSelect() more than once is another question, however as there is no error raised and this limitation is not documented, I'd consider it a bug.

The channel uses a counter m_nextPubSeqNo to identify published messages and store them as unconfirmed. The server acknowledges the published messages using the same identifier and this permits the channel to confirm delivery.

However, ModelBase.ConfirmSelect() sets m_nextPubSeqNo to 1 regardless of whether the channel has already had confirms enabled by a previous call to ConfirmSelect(). On the server side this sequence counter is not reset. The two become desynchronised and acknowledgements arrive that do not correspond to the messages published. Functions like WaitForConfirms() wait forever as messages are never confirmed.

After comparing the implementation of the java client, there is definitely a divergence of behaviour between the two. In the java client nextPublishSeqNo is set to 1 only if it was previously 0. In the c# client, no such test is made.

ModelBase.cs:
   973         public void ConfirmSelect()
   974         {
   975             m_nextPubSeqNo = 1;
   976             _Private_ConfirmSelect(false);
   977         }

ChannelN.java:
  1054     public Confirm.SelectOk confirmSelect()
  1055         throws IOException
  1056     {
  1057         if (nextPublishSeqNo == 0) nextPublishSeqNo = 1;
  1058         return (Confirm.SelectOk)
  1059             exnWrappingRpc(new Confirm.Select(false)).getMethod();
  1060 
  1061     }

A correction of this behaviour would be trivial, I hope my description has helped!

Regards

Cordialement,
Robert Higgins
Ingénieur R&D

rhi at np6.com
 
Tel :  +33 (0)5 57 92 41 21
Fax :  +33 (0)5 57 92 07 17

www.np6.com




Bordeaux
32 av Canteranne 
33600 Pessac 
T. 05 57 92 41 21
Paris
131 bd Sébastopol
75002 Paris
T. 01 75 43 76 10
London
58 Broadwick Street
London W1F 7AL 
T. +44 207 434 7383 





More information about the rabbitmq-discuss mailing list