[erlang-questions] Resisting "noconnection" / Remote termination of nodes

Olivier BOUDEVILLE olivier.boudeville@REDACTED
Thu Apr 26 17:53:06 CEST 2012


Hi Netch,

Thanks for the hint: I was aware of net_kernel:connect_node/1 but not of 
erlang:disconnect_node/1 (a bit confusing to find them in different 
places!). 

My (speculative) point was that erlang:monitor_node/0 and 
net_kernel:monitor_nodes/0 would not have prevented 'noconnection' to 
happen, which I see as a sign that other processes might be trying to 
access a node that is being shut down. 

On the other end, I did find any process doing so (yes, this does not 
imply much!) and I wonder whether rpc:cast( N, erlang, halt, [] ) could 
not be a reason sufficient by itself to trigger a 'noconnection' (doing a 
local halt() thanks to an idle process already on the target node never 
shown any noconnection). That's why I was inquiring about whether 
'noconnection' could be a little bit more talkative or even catchable 
(unless I am mistaken, it is not possible?).

Anyway at least for my very specific problem, the issue seems to be closed 
(at least for the moment!).

Thanks!

Best regards,

Olivier Boudeville.
---------------------------
Olivier Boudeville

EDF R&D : 1, avenue du Général de Gaulle, 92140 Clamart, France
Département SINETICS, groupe ASICS (I2A), bureau B-226
Office : +33 1 47 65 59 58 / Mobile : +33 6 16 83 37 22 / Fax : +33 1 47 
65 27 13



netch@REDACTED 
26/04/2012 11:38

A
olivier.boudeville@REDACTED
cc
erlang-questions@REDACTED
Objet
Re: [erlang-questions] Resisting "noconnection" / Remote termination of 
nodes






 Tue, Apr 24, 2012 at 13:52:18, olivier.boudeville wrote about 
"[erlang-questions] Resisting "noconnection" / Remote termination of 
nodes": 

> As I want now these terminations to be synchronous (i.e. I want my 
> terminate function to return only when all nodes are down for sure), I 
> used to rely on checking their termination using net_adm:ping/1 (waiting 

> for pong to become pang), but kept on getting (systematically) 
> 'noconnection' errors (exceptions?), which do not seem to be catchable 
(at 
> least not with a 'try .. catch T:E ->.. end' clause).

Seems this is good case for erlang:monitor_node(). Initially, check each
node from the list and subscribe to nodedown messages using
monitor_node() if it is shown alive. Then make multicast halt request
and loop around nodedown messages, dropping nodes from list on each one.
Exit on empty list.
Also net_kernel:monitor_nodes() provide similar ability.

The only side issue I see is that it tries to connect to node if there
is no connection yet, so you one can occur a potential race if some
another agent performs similar action. If this is your case, separate
node control to own manager process.

> I feel I would need something like net_kernel:unconnect_node/1.

It's erlang:disconnect_node/1, but I doubt it is useful for your goal.

> My question now: how to deal gracefully with such a synchronous node 
> shutdown and to resist to the (intended) loss of node(s)? 

Seems something is unclear in your description so feel free to
reformulate it.


-netch-




Ce message et toutes les pièces jointes (ci-après le 'Message') sont établis à l'intention exclusive des destinataires et les informations qui y figurent sont strictement confidentielles. Toute utilisation de ce Message non conforme à sa destination, toute diffusion ou toute publication totale ou partielle, est interdite sauf autorisation expresse.

Si vous n'êtes pas le destinataire de ce Message, il vous est interdit de le copier, de le faire suivre, de le divulguer ou d'en utiliser tout ou partie. Si vous avez reçu ce Message par erreur, merci de le supprimer de votre système, ainsi que toutes ses copies, et de n'en garder aucune trace sur quelque support que ce soit. Nous vous remercions également d'en avertir immédiatement l'expéditeur par retour du message.

Il est impossible de garantir que les communications par messagerie électronique arrivent en temps utile, sont sécurisées ou dénuées de toute erreur ou virus.
____________________________________________________

This message and any attachments (the 'Message') are intended solely for the addressees. The information contained in this Message is confidential. Any use of information contained in this Message not in accord with its purpose, any dissemination or disclosure, either whole or partial, is prohibited except formal approval.

If you are not the addressee, you may not copy, forward, disclose or use any part of it. If you have received this message in error, please delete it and all copies from your system and notify the sender immediately by return message.

E-mail communication cannot be guaranteed to be timely secure, error or virus-free.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20120426/82444f6b/attachment.htm>


More information about the erlang-questions mailing list