[erlang-questions] 1PB of arg_reg - wait what?
Sverker Eriksson
sverker.eriksson@REDACTED
Mon Sep 9 19:12:16 CEST 2013
On 05/08/2012 04:30 PM, Simon MacMullen wrote:
> We've just had a report of a Rabbit broker dying trying to allocate
> approximately 1PB of memory:
>
> http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/2012-May/019896.html
>
> Slogan: std_alloc: Cannot allocate 1124304355803072 bytes of memory
> (of type "arg_reg").
>
> Which is unfortunate enough in itself - but arg_reg? My understanding
> of beam internals is not great, but that looks to be something like a
> stack frame. A 1PB stack frame?
>
> As far as I can see "arg_reg" memory is only allocated in one place,
> around line 3100 of beam_emu.c:
>
> https://github.com/erlang/otp/blob/maint/erts/emulator/beam/beam_emu.c#L3157
>
>
> ...where size is set to c_p->arity * sizeof(c_p->arg_reg[0]).
>
> process.arg_reg is an Eterm*, so sizeof(Eterm) *cannot* be huge, so it
> must be the arity which is ~10^15. We have some excessive arities in
> RabbitMQ, but not quite to that extent.
>
> Does anyone have any idea how this could arise, or can it just be
> chalked up to cosmic rays?
>
c_p->arity in this case is supposed to be the number of arguments to
some function or fun.
The allocation is made to save the function arguments before the process
is scheduled out.
I seems the c_p->arity has got an insanely large value for some reason.
A core dump would be more helpful to track down this bug. Command line
option +d can be used to skip the erl_crash_dump and get a more usable
core dump.
/Sverker
Erlang/OTP Ericsson
More information about the erlang-questions
mailing list