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

Lennart Öhman <>
Wed Jul 25 17:35:29 CEST 2007


Hi,
have you turned trap_exit to true in your worker?

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: 
-----Original Message-----
From:  [mailto:] 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

http://www.erlang.org/mailman/listinfo/erlang-questions



More information about the erlang-questions mailing list