Server runs out of memory, crashes


We diagnose and fix a common problem, the server runs out of memory and crashes (or at least your system complains bitterly).


The most usual cause for this problem is that a publisher is sending messages to a queue, but no-one is reading them off the queue, or the consumers are just too slow. OpenAMQ has some built-in limits but these may be too high, they are designed for big servers.


First, run the server with —dump-trace 1 and observe the console output. It will say something like this:

2007-08-10 17:29:39: I: cnn=2 msg=32947 mem=32948K/168081K exc=8 que=1 csm=1

Here it's pretty clear, the server is being overloaded with messages (32k of them) in one queue, with one consumer that is (presumably) too slow.

Try using the —max_memory_mb option to limit memory. The server will throw out messages if it hits the limit.

Better, configure your queues to have a lower limit (the default is 50k messages). Create a file called amq_server.cfg that contains this:

    <queue_profile name = "private">
        <limit name = "warn" value = "1000" />
        <limit name = "trim" value = "5000" />

    <queue_profile name = "shared">
        <limit name = "warn" value = "1000" />
        <limit name = "kill" value = "5000" />
  • Pieter Hintjens <moc.xitami|hp#moc.xitami|hp>