[erlang-questions] gen_server and the run-time errors

Gilberio Carmenates García co7eb@REDACTED
Wed Dec 8 01:14:12 CET 2010


Hi! Info,

The terminate function isn't called possibility because the gen_server never
started,
Your problem could be I'm close sure because the init() need to be ended
with a {ok, Pid}, Pid could be self(). If you end the init() function with
other thing, the same error you saw is threw.


Good Example:

init(Args)->
	process_flag(trap_exit,true),
	evo_db_module:start(Args),
	{ok, self()}.


Bad Example:

init(Args)->
	process_flag(trap_exit,true),
	evo_db_module:start(Args),
	some_fun_that_not_returns_ok_pid().

	
=INFO REPORT==== 7-Dec-2010::20:37:58 ===
    application: evo
    exited: {shutdown,{evo,start,[normal,[{...}]]}}
    type: temporary

Best,

Ivan.


-----Mensaje original-----
De: erlang-questions@REDACTED [mailto:erlang-questions@REDACTED] En
nombre de info
Enviado el: Martes, 07 de Diciembre de 2010 14:50
Para: erlang-questions
Asunto: [erlang-questions] gen_server and the run-time errors

Hello,
I have a run-time error in the init part of a gen_server.
- Init begin by process_flag(trap_exit,true)
- gen_server is part of a supervision tree
I try to print the reason in the terminate module but it seems to exit
elsewhere.
- why terminate is not called ?
The application stops with shutdown as reason. 
- How and where to catch the run-time error ?

J-Ph. Constantin
ITS3 Genhve
www.its3.ch


=======================================================================
Este mensaje ha sido enviado mediante el servicio de correo electrónico que ofrece la Federación de Radioaficionados de Cuba a sus miembros para respaldar el cumplimiento de los objetivos de la organización y su política informativa. La persona que envía este correo asume el compromiso de  usar el servicio a tales fines y cumplir con las regulaciones establecidas.




More information about the erlang-questions mailing list