title: Erlang crashes (must be ejabberd): Why and how to debug the logfile?
body: <p>Everyday I have a new Erlang crash report on my server. As ejabberd is the only Erlang-thing I use, this must be the cause of the crash.</p>
  
  <p>The logfile (<code>erl_crash.dump</code>) has almost 9,000 lines so I have no idea how to debug that. But when I searched for "ejabberd" in that logfile, there were 5 occurrences - and every single occurrence was something related to "ejabberdctl".</p>
  
  <p>I'm addressing ejabberdctl via PHP script (<code>exec()</code>) to programatially create users. Could that be the cause for the crash (somehow)?</p>
  
  <p>In <code>/var/log/ejabberd</code> directory, I've found some errors in <code>erlang.log</code> and <code>ejabberd.log</code>. But I don't really know how to resolve them:</p>
  
  <pre><code>=ERROR REPORT====
  Mnesia('ejabberd@MYHOST'): ** ERROR ** (core dumped to file: "/var/lib/ejabberd/MnesiaCore.ejabberd@MYHOST_...")
   ** FATAL ** mnesia_monitor crashed: {badarg,
                                        [{ets,lookup,
                                          [mnesia_decision,
                                           'ejabberdctl@MYHOST']},
                                         {mnesia_recover,has_mnesia_down,1},
                                         {mnesia_monitor,handle_info,2},
                                         {gen_server,handle_msg,5},
                                         {proc_lib,init_p_do_apply,3}]} state: {state,
                                                                                &lt;0.65.0&gt;,
                                                                                [],
                                                                                [],
                                                                                true,
                                                                                [],
                                                                                undefined,
                                                                                []}
  
  =ERROR REPORT====
  Mnesia('ejabberd@MYHOST'): ** WARNING ** Mnesia is overloaded: {dump_log,
                                                                             time_threshold}
  
  =CRASH REPORT====
    crasher:
      initial call: ejabberd_listener:init/3
      pid: &lt;0.366.0&gt;
      registered_name: []
      exception exit: {timeout,
                          {gen_server,call,
                              [&lt;0.682.0&gt;,{become_controller,&lt;0.685.0&gt;}]}}
        in function  gen_server:call/2
        in call from ejabberd_listener:accept/3
      ancestors: [ejabberd_listeners,ejabberd_sup,&lt;0.39.0&gt;]
      messages: [{#Ref&lt;0.0.0.11304&gt;,ok}]
      links: [#Port&lt;0.2761&gt;,&lt;0.274.0&gt;]
      dictionary: []
      trap_exit: false
      status: running
      heap_size: 2584
      stack_size: 24
      reductions: 20938
    neighbours:
  </code></pre>