Rabbitmq v2 8 x - Also a problem in 3.0 client BTW.....

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 has been placed in a new lock statement to prevent this.