[rabbitmq-discuss] RabbitMQ crashes hard when it runs out of memory

Stephen Day sjaday at gmail.com
Thu Nov 5 21:57:31 GMT 2009


Its been awhile since I brought this up, but made I a small patch to the
memory supervisor that has fixed most of the memory usage problems.
Basically, I just force a garbage collect before checking the memory alarm
condition:

diff -r 7b0512cdf3bc src/vm_memory_monitor.erl
--- a/src/vm_memory_monitor.erl    Thu Nov 05 15:19:05 2009 +0000
+++ b/src/vm_memory_monitor.erl    Thu Nov 05 13:48:06 2009 -0800
@@ -174,6 +174,7 @@

 internal_update(State = #state { memory_limit = MemLimit,
                                  alarmed = Alarmed}) ->
+    [garbage_collect(P) || P <- processes()],
     MemUsed = erlang:memory(total),
     NewAlarmed = MemUsed > MemLimit,
     case {Alarmed, NewAlarmed} of

Indeed, this is a bit heinous, but it gets the job done. Unfortunately, I
don't have the appropriate bug id so I didn't create an hg branch for you to
pull from.

As far as overall system effects go, I haven't noticed any (aside from the
lack of crashes). We have been running this in production for a bit and
haven't seen any large problems, although the application is low throughput.
Are there any performance unit tests that I can run to check this?

Stephen J Day
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20091105/a85a5605/attachment.htm 


More information about the rabbitmq-discuss mailing list