[rabbitmq-discuss] RabbitMq client and AppDomain unload

Dmitry Naumov dmitry.naumov78 at gmail.com
Wed May 21 22:07:00 BST 2014


I have separate AppDomains (not primary) where I use RabbitMq.Client 
(RMQC). When I try to unload domain it seems like RMQC prevents to do it 
gracefully.
ConnectionBase creates 2 _foreground_ threads which in case of absence of 
messages are blocked inside Socket.Receive and do not check external flags 
like m_running/m_closed.
Yes, ConnectionBase has subscription to DomainUnload:

AppDomain <http://127.0.0.1/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.AppDomain>.CurrentDomain <http://127.0.0.1/roeder/dotnet/Default.aspx?Target=code://mscorlib:4.0.0.0:b77a5c561934e089/System.AppDomain/property:CurrentDomain:System.AppDomain>.DomainUnload <http://127.0.0.1/roeder/dotnet/Default.aspx?Target=code://mscorlib:4.0.0.0:b77a5c561934e089/System.AppDomain/event:DomainUnload:System.EventHandler> += new EventHandler <http://127.0.0.1/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.EventHandler>(this.HandleDomainUnload <http://127.0.0.1/roeder/dotnet/Default.aspx?Target=code://RabbitMQ.Client:3.2.1.0:89e7d7c5feba84ce/RabbitMQ.Client.Impl.ConnectionBase/HandleDomainUnload(Object,System.EventArgs)>);


but it won't be called if any foreground threads prevent domain from unloading.

It would be nice if all threads created inside ConnectionBase would have IsBackground set to true.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20140521/5ade041e/attachment.html>


More information about the rabbitmq-discuss mailing list