Cannot allocate memory (of type "heap").

Hi,

my ejabberd crashed, with the following error message found in erl_crash.dump:

Slogan: eheap_alloc: Cannot allocate 747325720 bytes of memory (of type "heap").
System version: Erlang (BEAM) emulator version 5.6.3 [source] [64-bit] [smp:2] [async-threads:0] [kernel-poll:true]
Compiled: Sun Jul 20 07:56:39 2008
Atoms: 35754

The jabber server (ejabberd 2.0.1) is running on latest Debian stable (2.6.18-6-xen-amd64) with 3 GB RAM. It is one of the 4 xen vhosts on the system.

How can I prevent situations like these from happening in the future?

Also, after enabling the watchdog_admins, the following kinds of messages keep appearing:

*(ejabberd@localhost) The process <0.202.0> is consuming too much memory:
[{old_heap_block_size,0},{heap_block_size,59786060},{mbuf_size,0},{stack_size,77},{old_heap_size,0},{heap_size,47843954}].
[{current_function,{dets_v9,binobjs2terms,6}},
{initial_call,{proc_lib,init_p,5}},
{message_queue_len,1},
{links,[<0.57.0>,<0.58.0>,#Port<0.1008>]},
{dictionary,[{1336,3384},
  {'$ancestors',[dets_sup,kernel_safe_sup,kernel_sup,<0.8.0>]},
  {312,1336},
  {'$initial_call',{dets,init,[<0.57.0>,<0.58.0>]}}]},
{heap_size,74732575},
{stack_size,69}]

These messages will show up whenever there are 'large' writes to disk on which ejabberd's IBA mnesia databases are stored, as well as spool directory pyicqt:

*Device: **tps         kB_read/s   kB_wrtn/s   kB_read   kB_wrtn**
sdb1     1.00       4.00            0.00            4               0

Device: tps         kB_read/s   kB_wrtn/s   kB_read   kB_wrtn
sdb1     1989.00 0.00            35812.00    0               35812

Device: tps**         kB_read/s   kB_wrtn/s   kB_read   kB_wrtn****
sdb1     2001.00 0.00            41760.00     0              41760

Device: tps**         kB_read/s   kB_wrtn/s   kB_read   kB_wrtn****
sdb1      0.00      0.00            0.00             0              0*

Together with those writes to disk, approximately 500-800 MB of RAM (depends on circumstances) is being allocated. The size of the writes is always between 40 and 70 MB/s - only frequency of their occurrence is changing (currently it is 1 per hour, yesterday it was every 5 seconds).

The filesystem type is ext3, and it is mounted as:
rw,noexec,nosuid,nodev,noatime,nodiratime,commit=1.

The jabber server itself has 19,000 registered users, max 200 of them are online simultaneously. The above-mentioned messages appear sporadically even when only 50 users are online.

Any help will be appreciated. :)

Some random comments

As I don't have a definite solution to your problem, I'll give you some random comments, in the hope that one of them helps you.

firefox wrote:

after enabling the watchdog_admins, the following kinds of messages keep appearing:

Yes, those message seem related to a table (Mnesia or ETS). Note that the watchdog feature has a prefixed threshold value that may not be proper for all possible servers: depending in the kind of usage, the threshold would report many warnings that are normal.

firefox wrote:

The jabber server itself has 19,000 registered users, max 200 of them are online simultaneously. The above-mentioned messages appear sporadically even when only 50 users are online.

firefox wrote:

Together with those writes to disk, approximately 500-800 MB of RAM (depends on circumstances) is being allocated.

I know an ejabberd 2.0.0 server in a 32bit system with 400 concurrent users consume 1000 MB of RAM.

firefox wrote:

System version: Erlang (BEAM) emulator version 5.6.3 [source] [64-bit] [smp:2] [async-threads:0] [kernel-poll:true]

You are using 64bit kernel: remember that the RAM consumption will be higher than the same load on 32bit.

If your users use transports, they probably will have large rosters with many 'transported' contacts. That will increase the size of the 'roster' table. That table is configured to be stored in disk and also in RAM. You can check the size of Mnesia tables in the Web Admin -> Nodes -> your node -> Data Base.

Syndicate content