[erlang-questions] Forcing `erl` not to start `epmd` OS process but starting `erl_epmd` process

Kenneth Lundin kenneth.lundin@REDACTED
Fri Oct 21 18:29:34 CEST 2011

Just start epmd yourself before start of Erlang nodes


Den 20 okt 2011 07.20, "Ciprian Dorin Craciun" <ciprian.craciun@REDACTED>

   Hello all!

   I'm using Erlang in a context where I want to "manually" start and
manage the EPMD OS process (for the usage of distributed Erlang
nodes). (By manually I mean as part of an OS related supervisor tree,
but not started by the erl interpreter.)

   Now after searching the Internet and the latest OTP sources, I
haven't found a way to properly do this. This is what I've found:
   * you could specify `-no_epmd` as an argument for the `erl`
invocation, which stops `erlexec.c` from executing `epmd`;
   * unfortunately specifying `-no_epmd` also stops
`erl_distribution` to start by default `erl_epmd` gen_server process
which is needed by `inet_tcp_dist`;

   A possible workaround I've found is to do the following (which I
think it is actually a bug):
   * add `-no_epmd whatever` to `erl` arguments; (it seems that
`erlexec.c` searches for `no_epmd` which sets an internal flag, but
also copies the whole argument to be read by `init:get_argument`);
   * doing this (adding `whatever`) makes
`init:get_argument(no_epmd)` return `{ok, [["whatever"]]` which
"fools" `erl_distribution` into thinking that `no_epmd` wasn't set (it
has a case with only the `{ok, [[]]}` and `_`);

   Also I've noticed that `erl_distribution` then uses the
`net_kernel:epmd_module()` fuction to find out the module to start.
There is an argument `-epmd_module` which could allow to change the
default module, but unfortunately there is a bug: it just returns the
string obtained directly from `init:get_argument`, which isn't an
atom, and thus it crashes the interpreter. Shouldn't it use
`list_to_atom`? (I'm almost certainly this is a bug. To check it just
run `erl` and ask for `net_kernel:epmd_module().`, then run `erl
-epmd_module whatever`, and ask again `net_kernel`.)

   Thanks for your feedback,
erlang-questions mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20111021/9d6da33f/attachment.htm>

More information about the erlang-questions mailing list