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

Michal Levý michal.liwoj at gmail.com
Sat Dec 29 11:19:51 GMT 2012


Hey Eric

Problem is probably in fact, that model instance should not be used from 
multiple threads. If you are publishing from multiple threads, each thread 
should use its own IModel instance...

Michal

On Monday, December 10, 2012 3:22:51 PM UTC+1, Eric Swann wrote:
>
> 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/20121229/14f94b48/attachment.htm>


More information about the rabbitmq-discuss mailing list