[erlang-questions] net_kernel:start/1 and EPMD gotcha
BOUDEVILLE Olivier
olivier.boudeville@REDACTED
Tue Jun 21 18:08:56 CEST 2016
Hi,
Shouldn't net_kernel:start/1 do the same as when a VM is run from the command-line with a short or long name, i.e. (among other things) also launch an EPMD instance if needed?
For the context (maybe it will help people encountering the same issue): we had an application which was running with long names until we had to include an optional information (an instance identifier) in the node names, an information that gets in some cases only available at runtime.
As renaming a node created with -sname or -name is apparently not possible (not_allowed), we resorted to changing the application so that its first node is launched initially in non-distributed mode and then, only once the identifier is available, turning this node in a distributed one, with net_kernel:start/1.
Unfortunately past launches had spawned an EPMD that was lingering in the background and gave us the impression that everything was working properly. However, while we were working on another feature, an update and a reboot had to occur, and the application became then unable to launch at all, with a somewhat cryptic message akin to:
{'EXIT',nodistribution}}},{child,undefined,net_sup_dynamic,{erl_distribution,start_link,[['my-foobar-node',longnames]]},permanent,1000,supervisor,[erl_distribution]}}...
It has been a long way to find IT updates, IPv4/IPv6 settings, host resolution, firewalls, cookies and all not guilty, and that the application was working iff another Erlang program had triggered the launch of an EPMD that had not been wiped yet.
At least, if EPMD was not launched transparently, as an improvement probably the error message could be clearer (like: "unable to connect to EPMD on port XXXX") and this sentence in http://erlang.org/doc/man/net_kernel.html#start-1 "Turns a non-distributed node into a distributed node by starting net_kernel and other necessary processes." could be rephrased in: "Turns a non-distributed node into a distributed node by starting net_kernel and other necessary (Erlang) processes, knowing that an EPMD instance is expected to be already running in the background."
Maybe it would be more user-friendly and consistent to have EPMD be launched automatically with net_kernel:start/1, though.
Thanks!
Best,
Olivier.
Olivier Boudeville
EDF R&D, Département SINETICS, Groupe ASICS, Bureau O2-E10
7, Boulevard Gaspard Monge, 91120 Palaiseau, France
Tél. : +33 (0)1 78 19 43 63
Tél. mobile : +33 (0)6 16 83 37 22
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/20160621/ac2a8184/attachment.htm>
More information about the erlang-questions
mailing list