From a0659634674df165482487495f8d10c3d755c60c Mon Sep 17 00:00:00 2001 From: Hans Bolinder Date: Mon, 15 May 2017 14:21:12 +0200 Subject: stdlib: Limit the size of gen_server's error events The state of the gen_server is limited in error events before exiting (if the Kernel variable error_logger_format_depth is set). An alternative is to let the error_logger limit all messages (error_msg, format, warning_msg, info_msg), which would not limit reports and also add a smallish overhead to event logging. It is not decided if the alternative is to be implemented. --- lib/stdlib/src/gen_server.erl | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/stdlib/src/gen_server.erl b/lib/stdlib/src/gen_server.erl index ba0a7ae8e5..460ea0ed16 100644 --- a/lib/stdlib/src/gen_server.erl +++ b/lib/stdlib/src/gen_server.erl @@ -107,8 +107,6 @@ %% Internal exports -export([init_it/6]). --import(error_logger, [format/2]). - %%%========================================================================= %%% API %%%========================================================================= @@ -864,11 +862,12 @@ error_info(Reason, Name, From, Msg, State, Debug) -> Reason end, {ClientFmt, ClientArgs} = client_stacktrace(From), - format("** Generic server ~p terminating \n" - "** Last message in was ~p~n" - "** When Server state == ~p~n" - "** Reason for termination == ~n** ~p~n" ++ ClientFmt, - [Name, Msg, State, Reason1] ++ ClientArgs), + LimitedState = error_logger:limit_term(State), + error_logger:format("** Generic server ~p terminating \n" + "** Last message in was ~p~n" + "** When Server state == ~p~n" + "** Reason for termination == ~n** ~p~n" ++ ClientFmt, + [Name, Msg, LimitedState, Reason1] ++ ClientArgs), sys:print_log(Debug), ok. client_stacktrace(undefined) -> -- cgit v1.2.3