[rabbitmq-discuss] Problem with c# client ModelBase.ConfirmSelect()
RHi at np6.com
Fri Feb 28 10:07:16 GMT 2014
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.
973 public void ConfirmSelect()
975 m_nextPubSeqNo = 1;
1054 public Confirm.SelectOk confirmSelect()
1055 throws IOException
1057 if (nextPublishSeqNo == 0) nextPublishSeqNo = 1;
1058 return (Confirm.SelectOk)
1059 exnWrappingRpc(new Confirm.Select(false)).getMethod();
A correction of this behaviour would be trivial, I hope my description has helped!
rhi at np6.com
Tel : +33 (0)5 57 92 41 21
Fax : +33 (0)5 57 92 07 17
32 av Canteranne
T. 05 57 92 41 21
131 bd Sébastopol
T. 01 75 43 76 10
58 Broadwick Street
London W1F 7AL
T. +44 207 434 7383
More information about the rabbitmq-discuss