[erlang-questions] How to reproduce OOM.

David Leach dleach@REDACTED
Fri Jul 17 02:44:28 CEST 2015


You could always try invoke OOM manually once memory has been used up. If sysrq trigger is enabled
Alt + SysRq/PrintScreen + f

or if supported on your system

os:cmd("echo b > /proc/sysrq-trigger")

However, it doesn't guarantee it's going to kill your process, just that it will kill something. See http://unix.stackexchange.com/questions/153585/how-oom-killer-decides-which-process-to-kill-first



________________________________________
From: erlang-questions-bounces@REDACTED <erlang-questions-bounces@REDACTED> on behalf of Jon Schneider <jon@REDACTED>
Sent: Thursday, 16 July 2015 12:07 a.m.
To: Daniil Churikov
Cc: erlang questions
Subject: Re: [erlang-questions] How to reproduce OOM.

The OOM killer is not a reliable thing and changes with the wind.

If you want a ceiling on memory how about using ulimit possibly from the
shell before starting beam ?

Jon


> Hello Dániel. Thanks for your suggestions, although it indeed creates
> memory allocation error,
> it does not do what I need.
> I want VM to be killed, but don't want to do it by myself. I am seeking
> for
> OOM killer's help,
> if you know what I mean ;)
>
> 2015-07-15 12:24 GMT+01:00 Dániel Szoboszlay <dszoboszlay@REDACTED>:
>
>> This one works for me quite reliably:
>>
>> Eshell V5.10.4.0.1  (abort with ^G)
>> 1> <<1:8000000000000>>.
>>
>> Crash dump was written to: erl_crash.dump
>> binary_alloc: Cannot allocate 1000000000031 bytes of memory (of type
>> "binary").
>> Aborted (core dumped)
>>
>>
>> 2015-07-15 13:18 GMT+02:00 Daniil Churikov <ddosia@REDACTED>:
>>
>>> Recently I was searching for robust way to restart elang VM in case of
>>> sudden
>>> stop (like crash or OOM).
>>> And I found rather difficult to reproduce OOM conditions: I was trying
>>> to
>>> create
>>> gigantic list of integers, so VM would be killed.
>>> I did this:
>>>
>>> L1 = [I || I <- lists:seq(1, 1000)].
>>> L2 = [L1 || _ <- lists:seq(1, 1000)].
>>> L3 = [L2 || _ <- lists:seq(1, 1000)]. % here VM hangs
>>>
>>> But according to syslog it doesn't look like OOM death, I can't see
>>> usual
>>> log
>>> entries like "Out of memory: Kill process 3855 (beam.smp) score 909 or
>>> sacrifice
>>> child" and others.
>>>
>>> My current understanding is I asked more memory then I allowed to ask,
>>> and b/c
>>> OS is not willing to give this memory, erlang VM hangs.
>>>
>>> If somebody have ideas how to reproduce OOM I would appreciate for
>>> sharing.
>>>
>>> Thanks!
>>>
>>> _______________________________________________
>>> erlang-questions mailing list
>>> erlang-questions@REDACTED
>>> http://erlang.org/mailman/listinfo/erlang-questions
>>>
>>>
>>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>

_______________________________________________
erlang-questions mailing list
erlang-questions@REDACTED
http://erlang.org/mailman/listinfo/erlang-questions



More information about the erlang-questions mailing list