[erlang-bugs] heart prevents beam from creating crash dumps

Richard Carlsson carlsson.richard@REDACTED
Mon Aug 27 21:01:47 CEST 2012


On 2012-08-27 10:37, Erik Søe Sørensen wrote:
> It'd probably make better sense to make the heart FD be the special
> case, like stdin/out/err are already.
>
> Alternatively, could the node communicate to heart that it is dumping,
> so that heart can leave it be (at least for a while)? That would of
> course also make the FD special, so probably no gain.

If the FD for heart is known to the C code, it can simply send the 
"shutdown" code to heart, just as it is done from the Erlang level when 
the node shuts down cleanly through init:stop(). (This would also 
prevent heart from interrupting the crash dump due to ping timeout.)

The problem is that at the point in the C code when the file descriptors 
are being closed, you can no longer do anything from Erlang code. You 
have to have a way of communicating the port number beforehand down to 
the C code that will write the crash dump, from the Erlang code that 
starts heart.

Of course, it makes heart the special case rather than EPMD (but I agree 
that closing all file descriptors is a good idea anyway since there may 
be other services running, so heart is probably the right choice). It 
also makes the heart protocol hardcoded into the Beam (right now it's 
only known to heart.erl and heart.c), but perhaps that should be frozen 
and officially documented anyway, together with the heart.c command line 
options so that one can more easily write a custom heart command. Maybe 
also add an option to specify the name of the command. (Right now, 
heart.erl does HeartCmd="heart -pid ...", so the executed command 
depends on your path.)

    /Richard




More information about the erlang-bugs mailing list