Unable to allocate 298930300 bytes of memory (type "old_heap")

When testing the load, my erlang server increased the number of (100, 200, 3000, ....) processes using + P, which is the maximum number of simultaneous processes, and also makes 10 processes send 1 message to the rest of the created processes, I got message on erlang console:

"The error dump was written in: erl_crash.dump. Eheap_alloc: cannot allocate 298930300 bytes of memory (like" old_heap "). Abnormal termination."

I am using Windows XP. This is not a problem when I create a process (it works). The crash occurs after the process begins to communicate (sends greetings and receives greetings), and this is the only problem I have (by the way, + hms, which sets the default heap size for processes).

How can i solve this?

+6
source share
4 answers

If someone finds this useful as one of the possible causes of such a problem (since I havenโ€™t found any specific answer anywhere), we had a similar problem with the rabbitmq server (linux, 64-bit, constant queue, watermarks with configuration by default)

eheap_alloc: Unable to allocate yyy bytes of memory (heap type)

eheap_alloc: Unable to allocate xxx bytes of memory (of type "old_heap")

The problem was the reordering of too many messages at once. Our โ€œcontrolโ€ code used the โ€œreceiveโ€ message with the option of re-queuing without limiting the number of messages to receive and re-queue (in our case, all messages in the queue, which was 4K) Thus, at that time he tried to add all these messages to Queue, server failure with the message above.

hope he saves a few hours to someone.

+3
source

Look at this erl_crash.dump file using Crashdump Viewer :

 /usr/local/lib/erlang/lib/observer-1.0/priv/bin/cdv erl_crash.dump 

(Apologies for the Unix path, you can find cdv.bat in your installation on Windows.)

See a list of processes; in my experience quite often there is a process with a very long queue of messages where you did not expect this.

+2
source

You have run out of memory. Try to reduce the default heap size or limit the number of running processes.

More advanced solutions include profiling your application to find out if you can save some memory there, for example, it is better to use binary files or less use lists and large messages (which will copy data for each process that it sent).

+1
source

One of your processes is trying to allocate almost 300 MB of memory. You probably have a memory leak on your server. In the right design, you should not have so many large heaps in one process, if it is not intended.

+1
source

Source: https://habr.com/ru/post/918141/


All Articles