[erlang-questions] [Q]: Terminating supervisor and its workers

Ladislav Lenart lenartlad@REDACTED
Wed Jul 25 17:48:10 CEST 2007


Lennart Öhman wrote:
> have you turned trap_exit to true in your worker?

No, I haven't. And frankly I don't want to. I am using
a standard piece of library functionality so why I have
to tweak my callback module to make it work? (I was
hoping that gen_server:start and gen_server:start_link
will make the difference.)

But if this is the Erlang way, I will do it.

Thanks for your prompt reply,

Ladislav Lenart

> A gen_server process does not automatically start trapping exits
> and will therefore of course respond immediately to an exit signal
> from its supervisor (an exit signal other than normal that is) unless
> trapping exits.
> 
> Best Regards
> Lennart
> 
> -------------------------------------------------------------------------------
> Lennart Öhman                    phone: +46 8 587 623 27
> Sjöland & Thyselius Telecom AB   cell : +46 70 552 6735
> Hälsingegatan 43, 10th floor     fax  : +46 8 667 8230
> SE-113 31 STOCKHOLM, SWEDEN      email: lennart.ohman@REDACTED
> -----Original Message-----
> From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Ladislav Lenart
> Sent: den 25 juli 2007 16:08
> To: Erlang-Questions (E-mail)
> Subject: [erlang-questions] [Q]: Terminating supervisor and its workers
> 
> Hello,
> 
> I have a supervisor that has one worker child (a gen_server) which has an ODBC session to a database. When I terminate the supervisor by evaluating exit(Sup, shutdown), ODBC session terminates with error saying that its client (my worker) was terminated "abnormally".
> 
> I thought that exit(Sup, shutdown) is the proper (normal) way how to gracefully terminate a supervision tree, meaning that gen_server terminate/2 callback function of my worker will be called...
> 
> So my question is, how to terminate a supervision tree so that a worker has a chance to clean up after itself?
> 
> Thanks,
> 
> Ladislav Lenart
> 
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
> 
> 





More information about the erlang-questions mailing list