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

Ladislav Lenart <>
Wed Jul 25 16:07:42 CEST 2007


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




More information about the erlang-questions mailing list