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

Ulf Wiger <>
Tue Mar 27 17:15:17 CEST 2012


Ok, then one thing that can be done is to create a 'wrapper application' that starts snmp as an included app.

Your start function would have to call the appropriate function in snmp, since included apps are not automatically started by OTP.

We used to do this at AXD 301, in order to ensure that applications using snmp did a takeover in synch with snmp itself. 

BR,
Ulf W

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

> My current problem is that it's not my application, it's OTP's. It's snmp. I tried using rpc:call/4 in my application's start/2 callback to call application:permit/2 but that just deadlocked.
> 
> 
> Ulf Wiger <> wrote:
> 
>> 
>> 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