Hey Eric<div><br></div><div>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...</div><div><br></div><div>Michal<br><br>On Monday, December 10, 2012 3:22:51 PM UTC+1, Eric Swann wrote:<blockquote class="gmail_quote" style="margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">When using publisher confirms with the C# code, there is a bug in the client when experiencing any significant load. &nbsp;The offending code is in the client "RabbitMQ.Client.Impl.<wbr>ModelBase" class in the "BasicPublish" method. &nbsp;<div><br></div><div><div>&nbsp; &nbsp; if (m_nextPubSeqNo &gt; 0) {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m_unconfirmedSet.<b>Add</b>(m_<wbr>nextPubSeqNo, null);</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m_nextPubSeqNo++;</div><div>&nbsp; &nbsp; }</div><div><br></div><div>It looks like there are multiple threads hitting the bolded "<b>Add</b>" method before the sequence number is incremented in the next line leading to duplicate key exceptions being thrown by the "m_unconfirmedSet" sorted list. &nbsp;&nbsp;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.</div><div><br></div><div><br></div><div><div><br></div></div></div></blockquote></div>