8000 Fix undesired start of epmd when calling relx_get_nodename by colrack · Pull Request #744 · erlware/relx · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix undesired start of epmd when calling relx_get_nodename #744

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 19, 2019

Conversation

colrack
Copy link
Contributor
@colrack colrack commented Jul 16, 2019

I don't have epmd started on my machine and I don't want epmd to start from a release.
If you set -start_epmd false in your vm.args I expect epmd not to start, like this:

/tmp/athc # ./bin/athcontroller console
Protocol 'inet_tcp': register/listen error: /tmp/athc #

Instead, because of an earlier call to relx_get_nodename here:

*) NAME=${NAME}@$(relx_get_nodename);; # Add @hostname

the result is an unwanted start of epmd.
The solution I propose is to pass ${START_EPMD} to erl inside relx_get_nodename so if -start_epmd is set to false we do not start epmd, rather we exit. Of course if you already have an instance of epmd running this works anyway.

@tsloughter
Copy link
Member

Hm, I'm going to have to look at this more thoroughly because I swear epmd isn't started when I use epmdless, and did a good bit of work to ensure that and to ensure stuff like cookies weren't created randomly. So I'm surprised this patch is needed.

@colrack
Copy link
Contributor Author
colrack commented Jul 16, 2019

More info here:
This happens only if you start the node with short names (-sname); with long names the patch is not needed.
Here the steps to reproduce:

docker run --rm -it erlang:22.0-alpine sh
/ # rebar3 version
rebar 3.11.1 on Erlang/OTP 22 Erts 10.4.1
/ # rebar3 new app myapp
===> Writing myapp/src/myapp_app.erl
===> Writing myapp/src/myapp_sup.erl
===> Writing myapp/src/myapp.app.src
===> Writing myapp/rebar.config
===> Writing myapp/.gitignore
===> Writing myapp/LICENSE
===> Writing myapp/README.md
/ # cd myapp/
### add relx to rebar.config
/myapp # cat rebar.config
{erl_opts, [debug_info]}.
{deps, []}.

{shell, [
  % {config, "config/sys.config"},
    {apps, [myapp]}
]}.

{relx, [{release, {myapp, "0.1.0"},
         [myapp]},
        {vm_args, "config/vm.args"},
        {include_erts, true},
        {extended_start_script, true}]
}.
### add vm.args
/myapp # cat config/vm.args
-sname node1
-setcookie secret
-start_epmd false
/myapp # rebar3 release
===> Verifying dependencies...
===> Compiling myapp
===> Starting relx build process ...
===> Resolving OTP Applications from directories:
          /myapp/_build/default/lib
          /usr/local/lib/erlang/lib
===> Resolved myapp-0.1.0
===> Including Erts from /usr/local/lib/erlang
===> release successfully created!
/myapp # cd /myapp/_build/default/rel/myapp/
/myapp/_build/default/rel/myapp # ps a
PID   USER     TIME  COMMAND
    1 root      0:00 sh
  203 root      0:00 ps a
/myapp/_build/default/rel/myapp # ./bin/myapp
Usage: myapp {start|start_boot <file>|foreground|stop|restart|reboot|pid|ping|console|console_clean|console_boot <file>|attach|remote_console|upgrade|downgrade|install|uninstall|versions|escript|rpc|rpcterms|eval|status|undefined}
/myapp/_build/default/rel/myapp # ps a
PID   USER     TIME  COMMAND
    1 root      0:00 sh
  250 root      0:00 /myapp/_build/default/rel/myapp/erts-10.4.1/bin/epmd -daemon
  282 root      0:00 ps a

@tsloughter
Copy link
Member

Sorry I didn't get back to you on this sooner.

I think the solution should be to check the vm.args for the -start_epmd false setting and include it when running those commands instead of adding a new environment variable.

@tsloughter
Copy link
Member

Argh, my bad, that is already how START_EPMD is set, ignore my last comment.

@tsloughter
Copy link
Member

And I just realized why I hadn't seen this issue before when using releases that don't start epmd and it is because I'd have set the full node name which keeps it from calling relx_get_nodename.

@tsloughter tsloughter merged commit ade76d1 into erlware:master Aug 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0