bitwalker / distillery

Simplify deployments in Elixir with OTP releases!
MIT License
2.97k stars 398 forks source link

Can't ping or access remote_console after updating Erlang and Elixir #734

Open Pedneri1 opened 3 years ago

Pedneri1 commented 3 years ago

Steps to reproduce and Description of issue

Hello! I’m having trouble accessing the remote_console after updating Elixir and Erlang on my build server. Everything starts up normally using the command my_app/bin/my_app foreground but when I try to run my_app/bin/my_app remote_console the application crashes and these errors appear:

1- On the console I ran foreground

19:44:23.509 [error] GenServer :net_kernel terminating
** (stop) bad return value: {:EXIT, {:undef, [{:erts_internal, :abort_connection, [:"my_app_maint_@127.0.0.1", {1, #Reference<0.321614115.3871473665.124992>}], []}]}}
Last message: {:EXIT, #PID<0.4889.0>, {:badarg, [{:erlang, :setnode, [:"my_app_maint_@127.0.0.1", #Port<0.68>, {31424444, 5, :"", :""}], []}]}}
{"Kernel pid terminated",application_controller,"{application_terminated,kernel,shutdown}"}
Kernel pid terminated (application_controller) ({application_terminated,kernel,shutdown})

2- On the other console that I ran remote_console or ping

** (exit) exited in: :gen_server.call(:net_kernel, {:connect, :hidden, :"my_app@127.0.0.1"}, :infinity)
    ** (EXIT) bad return value: {:EXIT, {:undef, [{:erts_internal, :abort_connection, [:"my_app@127.0.0.1", {1, #Reference<0.2859229408.4140957697.178983>}], []}, {:net_kernel, :pending_nodedown, 4, [file: 'net_kernel.erl', line: 980]}, {:net_kernel, :conn_own_exit, 3, [file: 'net_kernel.erl', line: 907]}, {:net_kernel, :do_handle_exit, 3, [file: 'net_kernel.erl', line: 875]}, {:net_kernel, :handle_exit, 3, [file: 'net_kernel.erl', line: 870]}, {:gen_server, :try_dispatch, 4, [file: 'gen_server.erl', line: 637]}, {:gen_server, :handle_msg, 6, [file: 'gen_server.erl', line: 711]}, {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 249]}]}}
    (stdlib) gen_server.erl:223: :gen_server.call/3
    lib/distillery/releases/runtime/control.ex:1006: Distillery.Releases.Runtime.Control.hidden_connect/1
    lib/distillery/releases/runtime/control.ex:438: Distillery.Releases.Runtime.Control.ping/2
    lib/entry.ex:47: Distillery.Releases.Runtime.Control.main/1
    (stdlib) erl_eval.erl:680: :erl_eval.do_apply/6
    (elixir) lib/code.ex:240: Code.eval_string/3 

Note: The same happens when running using my_app/bin/my_app start

elixir --version on build Server: Elixir 1.10.4 Erlang/OTP 23

elixir --version on execution Server: Elixir 1.10.4 Erlang/OTP 23

Distillery is running on version 2.1 and Edeliver on 1.7

The OS is Ubuntu 18.4 on both build and execution servers

manuel-rubio commented 3 years ago

Looks like you're not including the system (ERTS or BEAM) into the build, so when you're updating the ERTS system (Erlang) it's disappearing without telling the previous system to upgrade to the new one. My advice, include always the system into a release to avoid this. Usually, into the rel/config.exs you should have:

environment :prod do
  set include_erts: true
  ...

If you are building using the dev environment that could be the reason because it's not working. Try building with this:

MIX_ENV=prod mix distillery.release