[rabbitmq-discuss] Memory Leak in RabbitMQ .NET Driver v1.7.1+

Bryan Murphy bmurphy1976 at gmail.com
Thu Mar 18 18:19:47 GMT 2010

Sometime between 1.7.0 and 1.7.1 (revision 262) the following line was added
to ConnectionBase.MainLoop in the RabbitMQ .NET driver:

  Thread.GetDomain().DomainUnload += new EventHandler(HandleDomainUnload);

I've found no place in the code where this event is unregistered, leading to
a memory leak every time a connection is disposed.  The following reference
chain compounds this problem if you send large messages and create/dispose a
large number of connections:

  DomainUnload -> Connection -> SocketFrameHandler ->
NetworkBinaryReader/Writer -> BufferedStream

We're currently seeing the symptoms of this in our production environment
where one of our processes (which usually settles in around 300mb) grows
upwards of 4gig over a 12 to 18 hour period.

I believe you can work around this by either rolling back to the 1.7.0
driver, or commenting out that line of code.  We're currently pushing out a
custom build of the driver to verify this fix, but it will be a few hours
until I know for sure.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20100318/efe7efb4/attachment.htm 

More information about the rabbitmq-discuss mailing list