Starting generic servers with proc_lib

Gunilla Arendt gunilla@REDACTED
Fri Aug 26 15:42:41 CEST 2005


I'm not sure I understand your question, but if you wonder how to get 
crash reports from a gen_server process, then the answer is that a 
gen_server automatically generates a crash report. But, the SASL event 
handler must be installed in the error_logger process, or the crash 
report is not printed to stdout.

That is: Either use the start_sasl boot script:

% erl -boot start_sasl

Or, start SASL from the Erlang shell:

1> application:start(sasl).

Or, install the event handler yourself:

1> error_logger:install_handler(sasl_report_tty_h, all).
ok
...

5> gen_server:cast(ab, error).
ok
=ERROR REPORT==== 26-Aug-2005::15:34:56 ===
** Generic server ab terminating
** Last message in was {'$gen_cast',error}
** When Server state == []
** Reason for termination ==
** bad

3>
=CRASH REPORT==== 26-Aug-2005::15:34:56 ===
   crasher:
     pid: <0.41.0>
     registered_name: ab
     error_info: bad
     initial_call: 
{gen,init_it,[gen_server,<0.39.0>,self,{local,ab},ab,[],[]]}
     ancestors: [<0.39.0>]
     messages: []
     links: []
     dictionary: []
     trap_exit: false
     status: running
     heap_size: 233
     stack_size: 21
     reductions: 120
   neighbours:

/ Gunilla

Benefits Dragon wrote:
> As part of a related topic ("Messages going missing in test suite"), I
> was wondering how you start_link generic servers with the proc_lib so
> I can get crash reports from them, the description says the proc_lib
> spawn and start functions are to replace the erl versions yet when you
> start a gen_server you don't use the erl version use call the
> gen_server module to do it. Can you still use the proc_lib module to
> start gen_servers?





More information about the erlang-questions mailing list