[erlang-questions] Re: limited error_logger dump (vm crashes because of generating dump)

Steve Vinoski vinoski@REDACTED
Mon Sep 20 14:55:32 CEST 2010


On Mon, Sep 20, 2010 at 2:53 AM, Max Lapshin <max.lapshin@REDACTED> wrote:
> In fact gen_server:format_status doesn't solve the problem:
>
> gen_server.erl:
>    format("** Generic server ~p terminating \n"
>           "** Last message in was ~p~n"
>           "** When Server state == ~p~n"
>           "** Reason for termination == ~n** ~p~n",
>           [Name, Msg, State, Reason1]),
>
>
> This formatting has problems: Reason1 maybe many megabytes big when
> state was big and some badmatch has met with it.
> Maybe it would be better to format status (change import from
> error_logger:format to error_logger_formatter:format) into
> limited-size binary in the dying process and only then send data to
> error_logger process. It will reduce memory consumption, lower
> bottleneck-ness of one-core error_logger.
>
> Speaking about detailed logging: in fact, it is usually interesting to
> know first 10-20 lines of termination Reason and process dictionay
> with each value, limited to 10-20 lines. Or 20-40. But not 400 000
> lines of state dump.

Perhaps you could provide your own format_status function for your gen_server:

http://erlang.org/doc/man/gen_server.html#Module:format_status-2

See especially the final paragraph of the description there.

--steve


More information about the erlang-questions mailing list