<div dir="ltr"><span style="font-size:12.8px">Hello,</span><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Sep 21, 2016 at 7:50 PM, Caragea Silviu <span dir="ltr"><<a href="mailto:silviu.cpp@gmail.com" target="_blank">silviu.cpp@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><br>The only question I have now is :<br><br>How I can make something to include in the logs more other info before process dies. like number of messages in the queue.<br><br>We tried to setup also a monitor to be triggered way less than the limit where it has to be killed:<br><br>Options = [{long_gc, 10000}, {large_heap, 1000000}, busy_port, busy_dist_port],<br>erlang:system_monitor(self(), Options),<br><br>handle_info({monitor, Pid, Type, Details}, State) -><br>    log_system_event({Type, Pid, Details}),<br>    {noreply, State};<br>    <br>log_system_event({large_heap, GcPid, Info}) -><br>    LogFun = fun() -><br>        case recon:info(GcPid, messages) of<br>      {messages, Messages} -><br>           ?WARNING_MSG("Large heap (~p): ~p~nProcess info: ~p~nProcess state size (words in the heap): ~p~nMessage queue(first 10):~p~n",<br>            [GcPid, Info, recon:info(GcPid), erts_debug:size(recon:get_<wbr>state(GcPid)), Messages]);<br>          undefined -><br>       ?WARNING_MSG("Large heap (~p): ~p~nProcess info is not available", [GcPid, Info])<br>        end<br>    end,<br>    spawn(LogFun);    <br>    <br>But unfortunately the processes that has this issues have a life time small than 4 seconds. And this event is never triggered in time.     <br><br>Any help is appreciated !</div></blockquote><div><br></div><div><div style="font-size:12.8px">You could try to use max_heap_size with #{ kill => false } and then install a specialized error_logger that listens to specifically that type of event and retrieves the information you want before killing the process. Depending on how fast you need the run-away process to be killed this may be acceptable to you.</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Another tip, you may want to configure the process to keep the message queue data off_heap for processes that tend to build large message queues. It will make the GC a lot happiers, but it will also make max_heap_size not include the message queue size when doing it's analysis.</div></div><div><br></div><div>Lukas</div></div></div></div>