[rabbitmq-discuss] .NET Client ConnectionFactory threading issues

Garry Shutler garry at robustsoftware.co.uk
Fri Apr 19 09:04:26 BST 2013


My understanding is that you should be sharing a single connection, not
connection factory, across all threads. You then use channels for that
single connection on each thread.

*Garry Shutler*
@gshutler <http://twitter.com/gshutler>
gshutler.com


On 18 April 2013 12:38, Chris Haines <cjbhaines at gmail.com> wrote:

> Sorry I forgot to mention. I am using the version 3.0.4
> client libraries and server.
>
>
> On Thursday, 18 April 2013 12:37:40 UTC+1, Chris Haines wrote:
>>
>> Hi All,
>>
>> I have attached a .cs Nunit test fixture to demonstrate a problem I am
>> having with the ConnectionFactory. If I create 100 connections in a for
>> loop single threaded then I can create them all in about 2 seconds. If I
>> create them via a number of threads, in my test I am using 100 threads to
>> create a connection on each, then I get a lot of timeout exceptions (my
>> test bails out after 60 seconds). I have tried sharing an instance of the
>> ConnectionFactory between all threads and also giving each thread its own
>> instance but they both have the same result. I have also tried locking
>> around the call to CreateConnection but that also didn't help.
>>
>> I find this behavior to be very strange. Has anyone else had similar
>> problems?
>>
>> Cheers,
>> Chris
>>
>
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20130419/6248b578/attachment.htm>


More information about the rabbitmq-discuss mailing list