[rabbitmq-discuss] C# client publisher confirm bug under load (2.8.7)

Eric Swann eric at ericswann.org
Mon Dec 10 14:22:51 GMT 2012


When using publisher confirms with the C# code, there is a bug in the 
client when experiencing any significant load.  The offending code is in 
the client "RabbitMQ.Client.Impl.ModelBase" class in the "BasicPublish" 
method.  

    if (m_nextPubSeqNo > 0) {
                m_unconfirmedSet.*Add*(m_nextPubSeqNo, null);
                m_nextPubSeqNo++;
    }

It looks like there are multiple threads hitting the bolded "*Add*" method 
before the sequence number is incremented in the next line leading to 
duplicate key exceptions being thrown by the "m_unconfirmedSet" sorted 
list.   This code either needs to have a lock around it or have 
m_nextPubSeqNo change to a long so that "Interlocked.Increment" can be used 
in the assignment.



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20121210/7c0ada14/attachment.htm>


More information about the rabbitmq-discuss mailing list