[erlang-questions] Shutting down part of a supervision tree

Niclas Eklund nick@REDACTED
Mon Sep 13 16:10:20 CEST 2010


The Erlang CORBA objects are roughly gen_server-wrappers (using the create 
option {pseudo, true} is the exception since these objects are not 
processes). Hence, you should have a look at the behavior of gen_server 
regarding the terminate function. E.g if the process trap exit signals, 
the IDL file(s) has been compiled using the IC option handle_info or not 

These links will probably be usefull to read as well:

  * http://www.erlang.org/doc/man/Module_Interface.html
  * http://www.erlang.org/doc/apps/orber/ch_stubs.html

Best regards,

Niclas @ Erlang/OTP

On Mon, 13 Sep 2010, Geoffrey Biggs wrote:

> Evening all,
> What is the accepted procedure for shutting down a part of a supervision
> tree?
> In my case, I have several CORBA objects that come and go. I'm managing
> them in a supervisor tree. The same supervisor that manages the CORBA
> objects also manages other Erlang processes. They are all meant to be
> shut down together; i.e. the supervisor, the workers and the CORBA
> objects operate as a single unit that comes and goes as necessary.
> The problem is that when they go, they need to de-register from a naming
> service. I've tried adding the de-registration call to the terminate/2
> function in the CORBA object provider, but I can't seem to find
> something that guarantees it gets called in a timely fashion, if at all.
> This causes my tests to fail, because the next test tries to create a
> new instance of the object and can't register it due to the old
> registration still existing on the name server (shows the tests are
> doing their job, though). Methods I've tried to shut down the whole
> construction are:
> -Calling "exit(S, normal)" on the supervisor.
> -Directly casting stop to the CORBA objects, then calling "exit(S,
> normal)" on the supervisor.
> -Same as above, but with various sleeps in the hope that this gives the
> CORBA objects time to do their thing (even though the child_specs give
> them 30 seconds to shut down).
> -Using supervisor:terminate_child on the CORBA objects.
> So far the best combination seems to be casting stop to the CORBA object
> (which is what I would expect to work), but even so, the supervisor
> seems to just dump the whole lot before this cast has time to take
> effect half the time - and it's not even consistent.
> Any advice on shutting down parts of a supervisor tree is appreciated.
> Geoff
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED

More information about the erlang-questions mailing list