[erlang-questions] Distributed Applications: Stop Before Start?

Ulf Wiger <>
Tue Mar 27 16:29:03 CEST 2012


In the start_phase() call, you can make a gen_server call to the foo_app
instance running on a and ask it to close its connections.

If that's what you're already doing, perhaps I misunderstood the question?

BR,
Ulf W

On 27 Mar 2012, at 07:01, Vance Shipley wrote:

> Is there a clever way to get "stop first" semantics out of dist_ac?
> 
> A distributed application in OTP may migrate from a failed node
> to another and it may migrate back when the original node returns.
> 
> You can initiate a transfer with application:permit(foo, false).
> The order of the callbacks is:
> 
>                     
>   ---------------------   -------------------
>                           foo_app:start({takeover, }, [])
>                           foo_app:start_phase(phase1, {takeover, }, [])
>                           foo_app:start_phase(phase2, {takeover, }, [])
>   foo_app:prep_stop([])
>   foo_app:stop([])
> 
> Only the start/2 and stop/1 callbacks are required, the others are optional.
> 
> I'm currently trying to distribute OTP's snmp application between two
> nodes on the same host but it fails in the situation above because it
> tries to bind to the address already in use:
> 
>     ** Configuration error: failed starting net-if: 
>     {udp_open,161,eaddrinuse}
> 
> So in this case I'd like to have the application stopped on the old
> node before it is started on the new node.
> 
> -- 
> 	-Vance
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions




More information about the erlang-questions mailing list