distillery icon indicating copy to clipboard operation
distillery copied to clipboard

THIS LIBRARY IS NOT COMPATIBLE WITH ERLANG/OTP 25

Open roychowdhuryrohit-dev opened this issue 2 years ago • 23 comments

Steps to reproduce

Producing a release using Distillery shows error.

Verbose Logs

Screenshot 2022-05-26 at 20 36 07

Description of issue

  • What are the expected results?
  • It should successfully produce release.
  • What version of Distillery?
  • 6700edb017804e51aec14dedb8df888d1db4e63c
  • What OS, Erlang/Elixir versions are you seeing this issue on?
  • All, Erlang/OTP 25

roychowdhuryrohit-dev avatar May 27 '22 08:05 roychowdhuryrohit-dev

Getting this as well, which makes our MacOS builds that install via brew (and brew doesn't let you downgrade versions, ugh) unusable

Just wanted to echo that I'm running into this too for https://github.com/wasmCloud/wasmcloud-otp/pull/409, and would be happy to help test a fix

cc @bitwalker / @mobileoverlord since this issue has been open for a bit

brooksmtownsend avatar Jun 02 '22 21:06 brooksmtownsend

@brooksmtownsend this is off-topic, but I can recommend using asdf for managing developer dependencies where you can pin on the exact version you need, per project even.

narrowtux avatar Jun 28 '22 14:06 narrowtux

@narrowtux Yeah asdf is pretty fantastic and what I ended up falling back to, the reason I preferred brew was simply for the speed of installation in CI builds

brooksmtownsend avatar Jun 28 '22 15:06 brooksmtownsend

similar for me

MIX_ENV=prod mix distillery.release

output

MIX_ENV=prod mix distillery.release                       
Generated demo app
==> Assembling release..
==> Building release demo:0.1.0 using environment prod
==> Including ERTS 13.0.3 from /usr/lib/erlang/erts-13.0.3
==> Release failed: no match of right hand side value: {:error, :eacces}
    (distillery 2.1.1) lib/distillery/releases/assembler.ex:863: Distillery.Releases.Assembler.create_RELEASES/2
    (distillery 2.1.1) lib/distillery/releases/assembler.ex:290: Distillery.Releases.Assembler.write_release_scripts/1
    (distillery 2.1.1) lib/distillery/releases/assembler.ex:50: Distillery.Releases.Assembler.assemble/1
    (distillery 2.1.1) lib/distillery/tasks/release.ex:130: Mix.Tasks.Distillery.Release.do_release/2
    (mix 1.13.2) lib/mix/task.ex:397: anonymous fn/3 in Mix.Task.run_task/3
    (mix 1.13.2) lib/mix/cli.ex:84: Mix.CLI.run_task/2
    (elixir 1.13.2) src/elixir_compiler.erl:73: :elixir_compiler.dispatch/4
    (elixir 1.13.2) src/elixir_compiler.erl:58: :elixir_compiler.compile/3

ziyouchutuwenwu avatar Aug 22 '22 00:08 ziyouchutuwenwu

Also seeing this;

==> Including ERTS 13.0.4 from /opt/homebrew/Cellar/erlang/25.0.4/lib/erlang/erts-13.0.4
==> Release failed: no match of right hand side value: {:error, :eacces}
    (distillery 2.1.1) lib/distillery/releases/assembler.ex:863: Distillery.Releases.Assembler.create_RELEASES/2
    (distillery 2.1.1) lib/distillery/releases/assembler.ex:290: Distillery.Releases.Assembler.write_release_scripts/1
    (distillery 2.1.1) lib/distillery/releases/assembler.ex:50: Distillery.Releases.Assembler.assemble/1
    (distillery 2.1.1) lib/distillery/tasks/release.ex:130: Mix.Tasks.Distillery.Release.do_release/2
    (mix 1.13.4) lib/mix/task.ex:397: anonymous fn/3 in Mix.Task.run_task/3
    (mix 1.13.4) lib/mix/cli.ex:84: Mix.CLI.run_task/2
    (elixir 1.13.4) src/elixir_compiler.erl:73: :elixir_compiler.dispatch/4
    (elixir 1.13.4) src/elixir_compiler.erl:58: :elixir_compiler.compile/3

randysecrist avatar Aug 25 '22 04:08 randysecrist

+1 here

andyleclair avatar Sep 21 '22 19:09 andyleclair

+1

cplotter avatar Sep 22 '22 08:09 cplotter

same, it seems to be due to the changes to the release handler in erlang otp 25.

tensor-programming avatar Sep 26 '22 05:09 tensor-programming

Same issue here

erlang - 25.0.4 elixir - 1.14.0-otp-25 OS - MacOS

Downgrading is not an option for me as we need the latest version of Elixir

==> Assembling release..
==> Building release management_portal_umbrella:0.1.0 using environment prod
==> Including ERTS 13.0.4 from /Users/carlflynn/.asdf/installs/erlang/25.0.4/erts-13.0.4
==> Packaging release..
==> Failed to archive release: _build/prod/rel/management_portal_umbrella/releases/RELEASES: no such file or directory

carflynn2009 avatar Sep 29 '22 09:09 carflynn2009

+1

lkananowicz avatar Oct 12 '22 10:10 lkananowicz

--- a/lib/distillery/releases/assembler.ex
+++ b/lib/distillery/releases/assembler.ex
@@ -860,7 +860,7 @@ defmodule Distillery.Releases.Assembler do
     # no work around for this
     old_cwd = File.cwd!()
     File.cd!(output_dir)
-    :ok = :release_handler.create_RELEASES('./', 'releases', '#{relfile}', [])
+    :ok = :release_handler.create_RELEASES(File.cwd!(), Path.join([File.cwd!(), 'releases']), '#{relfile}', [])
     File.cd!(old_cwd)
     :ok
   end

I have a local fork that works with just this change within lib/ so if you use a git dependency in your mix file, you can use your own fork with this change.

Getting the tests to run has been a challenge and required quite a few changes. I had to comment out the cookie tests because I couldn't hit quvic.com from behind a firewall. Also, the "directory with space in name" wouldn't work for me so I just removed it.

If I can find the time to run tests across several versions of Elixir & OTP, I'll submit a MR. If someone else submits this fix based on this post, thanks!

Tested with Elixir 1.12.3 & 1.13.4 + Erlang 25.0.4.

austinsalonen avatar Oct 14 '22 20:10 austinsalonen

==> Assembling release.. ==> Building release phoenix_sample:0.1.0 using environment prod ==> Including ERTS 13.1.2 from /home/miguel/.asdf/installs/erlang/25.1.2/erts-13.1.2 ==> Packaging release.. ==> Failed to archive release: _build/prod/rel/phoenix_sample/releases/RELEASES: no such file or directory

Using {:distillery, "~> 2.1"} and {:phoenix, "~> 1.6.15"}

MichaelSzer avatar Dec 21 '22 16:12 MichaelSzer

==> Assembling release.. ==> Building release phoenix_sample:0.1.0 using environment prod ==> Including ERTS 13.1.2 from /home/miguel/.asdf/installs/erlang/25.1.2/erts-13.1.2 ==> Packaging release.. ==> Failed to archive release: _build/prod/rel/phoenix_sample/releases/RELEASES: no such file or directory

Using {:distillery, "~> 2.1"} and {:phoenix, "~> 1.6.15"}

@carflynn2009 @MichaelSzer I would recommend simply adding the RELEASES directory inside of _build/prod/rel/phoenix_sample/releases. This worked for me on my local development environment. It doesn't seem like this is generated by default.

zazaian avatar Feb 17 '23 23:02 zazaian

This has fixed the distillery issue for me when upgrading to Elixir 1.15.4 and OTP 26: https://github.com/bors-ng/bors-ng/pull/1561

However, the remote-console command ended up crashing with this error:

=CRASH REPORT==== 5-Oct-2023::18:34:46.165601 ===
  crasher:
    initial call: supervisor_bridge:user_sup/1
    pid: <0.3882.0>
    registered_name: []
    exception error: undefined function 'Elixir.IEx.CLI':start/0
      in function  user_sup:start_user/3 (user_sup.erl, line 102)
      in call from user_sup:init/1 (user_sup.erl, line 51)
      in call from supervisor_bridge:init/1 (supervisor_bridge.erl, line 87)
      in call from gen_server:init_it/2 (gen_server.erl, line 962)
      in call from gen_server:init_it/6 (gen_server.erl, line 917)
    ancestors: [kernel_sup,<0.3850.0>]

I was able to fix the above by adding exec before iex here: https://github.com/bitwalker/distillery/blob/3ab4d6146c7bc18139ed75d330e4fbb0fceb7591/priv/libexec/commands/remote_console.sh#L26

Hope this helps someone in need.

Lucian-Bosinceanu avatar Oct 11 '23 08:10 Lucian-Bosinceanu

Has anyone seen this when using remote_console? If I read this right; it seems like Elixir.iEx.CLI is undefined - however it is part of the release and I can see its beams in the ebin dir within the release directory ...

OTP: 26.1 (only erts is installed as part of the release)
Elixir 1.15.7
2023-12-05 21:33:12.185235 crash_report
    initial_call: {supervisor_bridge,user_sup,['Argument__1']}
    pid: <0.71.0>
    registered_name: []
    error_info: {error,undef,[{'Elixir.IEx.CLI',start,[],[]},{user_sup,start_user,3,[{file,"user_sup.erl"},{line,102}]},{user_sup,init,1,[{file,"user_sup.erl"},{line,51}]},{supervisor_bridge,init,1,[{file,"supervisor_bridge.erl"},{line,87}]},{gen_server,init_it,2,[{file,"gen_server.erl"},{line,962}]},{gen_server,init_it,6,[{file,"gen_server.erl"},{line,917}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,241}]}]}
    ancestors: [kernel_sup,<0.47.0>]
    message_queue_len: 0
    messages: []
    links: [<0.49.0>]
    dictionary: []
    trap_exit: true
    status: running
    heap_size: 1598
    stack_size: 28
    reductions: 334
=SUPERVISOR REPORT==== 5-Dec-2023::21:33:12.185290 ===
    supervisor: {local,kernel_sup}
    errorContext: start_error
    reason: {undef,
                [{'Elixir.IEx.CLI',start,[],[]},
                 {user_sup,start_user,3,[{file,"user_sup.erl"},{line,102}]},
                 {user_sup,init,1,[{file,"user_sup.erl"},{line,51}]},
                 {supervisor_bridge,init,1,
                     [{file,"supervisor_bridge.erl"},{line,87}]},
                 {gen_server,init_it,2,[{file,"gen_server.erl"},{line,962}]},
                 {gen_server,init_it,6,[{file,"gen_server.erl"},{line,917}]},
                 {proc_lib,init_p_do_apply,3,
                     [{file,"proc_lib.erl"},{line,241}]}]}
    offender: [{pid,undefined},
               {id,user},
               {mfargs,{user_sup,start,[]}},
               {restart_type,temporary},
               {significant,false},
               {shutdown,2000},
               {child_type,supervisor}]

randysecrist avatar Dec 05 '23 21:12 randysecrist

@randysecrist I had the same problem, please see above.

Lucian-Bosinceanu avatar Dec 05 '23 22:12 Lucian-Bosinceanu

@Lucian-Bosinceanu

I did try that; and it works great if a full install is available.

I am however using the set include_erts: true in the rel/config.exe .. thus iex isn't available directly; only erts. (small footprint required)

randysecrist avatar Dec 07 '23 06:12 randysecrist

@randysecrist did you find a solution?

jweinkam avatar Dec 12 '23 16:12 jweinkam

@jweinkam no, not when using a base image with only the release + erts (include_erts ) copied into it. This used to work just fine with OTP 24. (i'm using 26 now; so it could be an issue not covered by this issue?)

randysecrist avatar Dec 15 '23 18:12 randysecrist

@randysecrist We have been using OTP 25 and Elixir 1.14.1 with a forked version of this library. The only change is

+++ b/lib/distillery/releases/assembler.ex
@@ -860,15 +860,7 @@ defmodule Distillery.Releases.Assembler do
     # no work around for this
     old_cwd = File.cwd!()
     File.cd!(output_dir)
-    :ok = :release_handler.create_RELEASES('./', 'releases', '#{relfile}', [])
+
+    :ok =
+      :release_handler.create_RELEASES(
+        File.cwd!(),
+        Path.join([File.cwd!(), 'releases']),
+        '#{relfile}',
+        []
+      )
+
     File.cd!(old_cwd)
     :ok
   end

We are attempting to switch to Elixir 1.15.7, but then get error

crasher:
 initial call: supervisor_bridge:user_sup/1
 pid: <0.4290.0>
 registered_name: []
 exception error: undefined function 'Elixir.IEx.CLI':start/0
   in function  user_sup:start_user/3 (user_sup.erl, line 100)
   in call from user_sup:init/1 (user_sup.erl, line 49)
   in call from supervisor_bridge:init/1 (supervisor_bridge.erl, line 87)
   in call from gen_server:init_it/2 (gen_server.erl, line 851)
   in call from gen_server:init_it/6 (gen_server.erl, line 814)
 ancestors: [kernel_sup,<0.4268.0>]
 message_queue_len: 0
 messages: []

We too are using set include_erts: true

jweinkam avatar Dec 15 '23 18:12 jweinkam

@jweinkam my intuition tells me this is a problem with the erlang boot file -> I can see that the `Elixir.IEx.CLI' module is included in the release; but erlang crying about it being undefined means that it isn't in the beam path for some reason.

I spent a day learning more about releases ; so next step is to go back and try to figure out if I can find where this plugin is broken .. or if I'm going to just script the release myself.

This is going to take some time ; i'm on holiday in a bit as well.

randysecrist avatar Dec 18 '23 15:12 randysecrist

So after a new year rest; and some poking - the problem is not that the module Elixir.IEx.CLI isn't on the code path ... it is that this value is passed to the -user switch when erl is invoked.

  • What was the intent of using this switch on startup?
  • Shouldn't this be Elixir.IEx? Testing with Elixir.IEx.CLI doesn't seem to spawn a new shell when I test it out with CTRL-G.

ref: https://hexdocs.pm/iex/1.15.7/IEx.html#module-the-user-switch-command

When I test with Elixir.IEx - this is what I see:

{{badmatch,{error,{kernel,{{shutdown,{failed_to_start_child,user,nouser}},
                           {kernel,start,[normal,[]]}}}}},
 [{'Elixir.IEx','-start/2-fun-3-',1,[{file,"lib/iex.ex"},{line,873}]}]}```

randysecrist avatar Feb 05 '24 04:02 randysecrist

fixed this in my fork: https://github.com/bors-ng/distillery/commit/578f12b5770ddee3e9b0a04d4443581f0b0fd10a

randysecrist avatar Feb 05 '24 20:02 randysecrist