New OTP app available at GitHub: riak_err

Scott Lystig Fritchie fritchie@REDACTED
Thu Nov 11 19:59:02 CET 2010


Hi, all, there's a new OTP app available over at GitHub that other users
may find useful: riak_err.  See https://github.com/basho/riak_err/

If you've ever been bitten by having a 5MB binary in an error message
explode (on a 64-bit platform) into over 300MB of short-term memory
usage(*) when the error_logger tries to format the message before
sending it to the console/TTY or writing it to a file, then you *really*
want some kind of solution.  Answering the question, "Why did the VM
crash with a memory allocation error?" for a grumpy customer isn't fun.

If an info/error/warning message (or report) is too big(**), then
Matthias Lang's nifty trunc_io.erl library is used to truncate the
formatted data.

The riak_err app is designed to be a mostly-painless way to limit the
amount of RAM that error messages consume while being formatted.  It's
just a matter of adding the riak_err application to your app's
app-dependency list.  That list is probably already starting the 'sasl'
app, so just add 'riak_err' immediately after 'sasl', and all should be
well.  :-)

I'd be really interested to know if there are any messages that are
overlooked when measuring & truncating, e.g. a SASL message or
something from the kernel or a user-generated message (using
error_logger:info_msg() and friends).

-Scott

(*) This has bitten me and my colleagues several times over the last
several years.

(**) As defined by two config knobs, see the README or EDoc for details.


More information about the erlang-questions mailing list