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

Ulf Wiger (TN/EAB) ulf.wiger@REDACTED
Thu Jul 26 09:30:15 CEST 2007


The OTP behaviours will only recognize {'EXIT',Pid,shutdown}
as a "normal" exit if Pid is the parent process.

You might want to try supervisor:terminate_child/2.

BR,
Ulf W

> -----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