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

Ciprian Dorin Craciun <>
Fri Oct 21 17:54:11 CEST 2011


On Thu, Oct 20, 2011 at 08:20, Ciprian Dorin Craciun
<> wrote:
>    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,
>    Ciprian.


    About the `net_kernel:epmd_module`, it seems it was fixed in
R14B03 (on my system it was R14B). :)

    The rest is still the case. (Related to how the `no_epmd` flag and
is handled by `erlexec.c` and `erl_distribution.erl`, which I've
described above).

    Ciprian.



More information about the erlang-questions mailing list