Skip to content
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

rebar3 crashing when compiling dependency with Elixir v1.15.0 (OTP 26) #2799

Open
kevinkirkup opened this issue Jun 23, 2023 · 6 comments
Open

Comments

@kevinkirkup
Copy link

Environment

  • Add the result of rebar3 report to your message:
❯ DIAGNOSTIC=1 mix install
===> Expanded command sequence to be run: []
===> Running provider: do
===> Expanded command sequence to be run: [app_discovery,{bare,compile}]
===> Running provider: app_discovery
===> Falling back to app.src file because .app failed: Cannot read app file: "/Users/xxx/repos/xxx/yyy/deps/ranch/ebin/ranch.app"

===> Uncaught error in rebar_core. Run with DIAGNOSTIC=1 to see stacktrace or consult rebar3.crashdump
===> Uncaught error: badarg
===> Stack trace to the error location:
[{erlang,'++',
         [undefined,".script"],
         [{error_info,#{module => erl_erts_errors}}]},
 {rebar_config,consult_file_,1,
               [{file,"/rebar3/apps/rebar/src/rebar_config.erl"},{line,260}]},
 {rebar_app_discover,create_app_info,3,
                     [{file,"/rebar3/apps/rebar/src/rebar_app_discover.erl"},
                      {line,413}]},
 {rebar_app_discover,try_handle_app_src_file,4,
                     [{file,"/rebar3/apps/rebar/src/rebar_app_discover.erl"},
                      {line,518}]},
 {rebar_utils,filtermap,2,
              [{file,"/rebar3/apps/rebar/src/rebar_utils.erl"},{line,114}]},
 {rebar_app_discover,do,2,
                     [{file,"/rebar3/apps/rebar/src/rebar_app_discover.erl"},
                      {line,28}]},
 {rebar_prv_app_discovery,do,1,
                          [{file,"/rebar3/apps/rebar/src/rebar_prv_app_discovery.erl"},
                           {line,38}]},
 {rebar_core,do,2,
             [{file,"/rebar3/apps/rebar/src/rebar_core.erl"},{line,155}]}]
===> When submitting a bug report, please include the output of `rebar3 report "your command"`
** (Mix) Could not compile dependency :ranch, "/Users/XXX/.asdf/installs/elixir/1.15.0-otp-26/.mix/elixir/1-15/rebar3 bare compile --paths /Users/XXX/repos/dlr/moneta/_build/dev/lib/*/ebin" command failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile ranch --force", update it with "mix deps.update ranch" or clean it with "mix deps.clean ranch"
  • Verify whether the version of rebar3 you're running is the latest release (see https://github.com/erlang/rebar3/releases)
  • If possible, include information about your project and its structure. Open source projects or examples are always easier to debug.
    If you can provide an example code base to reproduce the issue on, we will generally be able to provide more help, and faster.

Current behaviour

rebar3 crashes when compiling the ranch library. It doesn't happen with my other project that also includes the same version of ranch.

DEBUG=1 rebar3 <my failing command>

Expected behavior

It compiles the ranch dependency correctly.

@kevinkirkup kevinkirkup changed the title rebar3 crashing when compiling dependency with Elixir 1.15.0 rebar3 crashing when compiling dependency with Elixir v1.15.0 (OTP 26) Jun 23, 2023
@ferd
Copy link
Collaborator

ferd commented Jun 24, 2023

  • can you specify which rebar3 version you're running? Don't know specifically which version mix is pulling in (something related to mix local.rebar). See the rebar3 report command the template asks for.
  • can you re-run the command with either DEBUG=1 or DIAGNOSTIC=1 configured in the environment so we can get more of the error log?
  • can you try running it with an option of :manager set to :rebar3 in the options for the dependencies? I know ranch defaults to makefiles as its primary tool so maybe it has an effect.

@crbelaus
Copy link

crbelaus commented Jun 27, 2023

I'm facing the same issue on Elixir 1.15 (but OTP 25 in my case). Running the command with DIAGNOSTIC=1 produces the following output:

===> Expanded command sequence to be run: []
===> Running provider: do
===> Expanded command sequence to be run: [app_discovery,{bare,compile}]
===> Running provider: app_discovery
===> Falling back to app.src file because .app failed: Cannot read app file: "/builds/example/myapp/deps/ranch/ebin/ranch.app"
===> Uncaught error in rebar_core. Run with DIAGNOSTIC=1 to see stacktrace or consult rebar3.crashdump
===> Uncaught error: badarg
===> Stack trace to the error location:
[{erlang,'++',
         [undefined,".script"],
         [{error_info,#{module => erl_erts_errors}}]},
 {rebar_config,consult_file_,1,
               [{file,"/rebar3/apps/rebar/src/rebar_config.erl"},{line,260}]},
 {rebar_app_discover,create_app_info,3,
                     [{file,"/rebar3/apps/rebar/src/rebar_app_discover.erl"},
                      {line,413}]},
 {rebar_app_discover,try_handle_app_src_file,4,
                     [{file,"/rebar3/apps/rebar/src/rebar_app_discover.erl"},
                      {line,518}]},
 {rebar_utils,filtermap,2,
              [{file,"/rebar3/apps/rebar/src/rebar_utils.erl"},{line,114}]},
 {rebar_app_discover,do,2,
                     [{file,"/rebar3/apps/rebar/src/rebar_app_discover.erl"},
                      {line,28}]},
 {rebar_prv_app_discovery,do,1,
                          [{file,"/rebar3/apps/rebar/src/rebar_prv_app_discovery.erl"},
                           {line,38}]},
 {rebar_core,do,2,
             [{file,"/rebar3/apps/rebar/src/rebar_core.erl"},{line,155}]}]
===> When submitting a bug report, please include the output of `rebar3 report "your command"`
==> myapp
** (Mix) Could not compile dependency :ranch, "/root/.mix/elixir/1-15/rebar3 bare compile --paths /builds/example/myapp/_build/test/lib/*/ebin" command failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile ranch --force", update it with "mix deps.update ranch" or clean it with "mix deps.clean ranch"

@rubysolo
Copy link

We experienced this same issue. Here's the output of rebar3 report compile:

Rebar report
91294718bd8b:/app# /root/.mix/elixir/1-15/rebar3 report compile
Rebar3 report
version 3.22.0
generated at 2023-06-30T21:48:45+00:00
=================
Please submit this along with your issue at https://github.com/erlang/rebar3/issues (and feel free to edit out private information, if any)
-----------------
Task: compile
Entered as:
compile
-----------------
Operating System: aarch64-unknown-linux-musl
ERTS: Erlang/OTP 25 [erts-13.2.2.1] [source] [64-bit] [smp:5:5] [ds:5:5:10] [async-threads:1] [jit]
Root Directory: /usr/local/lib/erlang
Library directory: /usr/local/lib/erlang/lib
-----------------
Loaded Applications:
bbmustache: 1.12.2
certifi: 2.11.0
cf: 0.3.1
common_test: 1.24
compiler: 8.2.6.2
crypto: 5.1.4
cth_readable: 1.5.1
dialyzer: 5.0.5
edoc: 1.2
erlware_commons: 1.6.0
eunit: 2.8.2
eunit_formatters: 0.5.0
getopt: 1.0.2
inets: 8.3.1
kernel: 8.5.4
providers: 1.9.0
public_key: 1.13.3
relx: 4.8.0
sasl: 4.2
snmp: 5.13.5
ssl_verify_fun: 1.1.6
stdlib: 4.3.1.1
syntax_tools: 3.0.1
tools: 3.5.3

-----------------
Escript path: /root/.mix/elixir/1-15/rebar3
Providers:
app_discovery as clean compile compile cover ct deps dialyzer do edoc escriptize eunit get-deps help install install_deps list lock new path pkgs release relup report repos shell state tar tree unlock update upgrade upgrade upgrade vendor version xref

Running with DIAGNOSTIC=1 produces the same stack trace as in the previous comment.

Adding this line to mix.exs (and then mix deps.clean ranch and mix deps.get) fixed the issue for ranch:

{:ranch, ">= 0.0.0", manager: :rebar3, override: true}

Cowlib had the same problem, but the same fix solved it as well.

@jtormey
Copy link

jtormey commented Jul 3, 2023

I ran into this in my Elixir CI pipeline after upgrading from 1.14 to 1.15. Fixed by clearing out the GitHub Actions cache.

@makoto-developer
Copy link

I also faced this problem now.

Sorry, I couldn't solve this work around

add {:ranch, ">= 0.0.0", manager: :rebar3, override: true}

I tried changing the version of Erlang, but could not solve the problem. I think this is a problem with Elixir on v1.5. Furthermore, I have not included telemetry package in mix.exs. So, is it a problem on cowboy's side?

@Nezteb
Copy link

Nezteb commented Dec 13, 2023

I've also started running into this recently, as has a coworker. Both of us are on newer M2 macOS machines and using the latest versions of asdf/asdf-erlang/asdf-elixir.

❯ DIAGNOSTIC=1 mix compile
===> Expanded command sequence to be run: []
===> Running provider: do
===> Expanded command sequence to be run: [app_discovery,{bare,compile}]
===> Running provider: app_discovery
===> Falling back to app.src file because .app failed: Cannot read app file: "/Users/noah/Git/backend/deps/ranch/ebin/ranch.app"

===> Uncaught error in rebar_core. Run with DIAGNOSTIC=1 to see stacktrace or consult rebar3.crashdump
===> Uncaught error: badarg
===> Stack trace to the error location:
[{erlang,'++',
         [undefined,".script"],
         [{error_info,#{module => erl_erts_errors}}]},
 {rebar_config,consult_file_,1,
               [{file,"/rebar3/apps/rebar/src/rebar_config.erl"},{line,260}]},
 {rebar_app_discover,create_app_info,3,
                     [{file,"/rebar3/apps/rebar/src/rebar_app_discover.erl"},
                      {line,413}]},
 {rebar_app_discover,try_handle_app_src_file,4,
                     [{file,"/rebar3/apps/rebar/src/rebar_app_discover.erl"},
                      {line,518}]},
 {rebar_utils,filtermap,2,
              [{file,"/rebar3/apps/rebar/src/rebar_utils.erl"},{line,114}]},
 {rebar_app_discover,do,2,
                     [{file,"/rebar3/apps/rebar/src/rebar_app_discover.erl"},
                      {line,28}]},
 {rebar_prv_app_discovery,do,1,
                          [{file,"/rebar3/apps/rebar/src/rebar_prv_app_discovery.erl"},
                           {line,38}]},
 {rebar_core,do,2,
             [{file,"/rebar3/apps/rebar/src/rebar_core.erl"},{line,155}]}]
===> When submitting a bug report, please include the output of `rebar3 report "your command"`
** (Mix) Could not compile dependency :ranch, "/Users/noah/.asdf/installs/elixir/1.15.7-otp-26/.mix/elixir/1-15/rebar3 bare compile --paths /Users/noah/Git/backend/_build/dev/lib/*/ebin" command failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile ranch --force", update it with "mix deps.update ranch" or clean it with "mix deps.clean ranch"

I'm not sure if it's related, but searching for the error message and "bare compile" did bring up this issue: #2102

Running mix clean --deps doesn't work.

Re-installing the Erlang/Elixir versions also doesn't seem to help (even after installing hex/rebar3).

Running ~/.asdf/plugins/erlang/kerl cleanup also doesn't fix it, which worked for me last month because of a similar issue.

I also tried uninstalling the asdf-erlang and asdf-elixir plugins completely, reinstalling them from scratch, reinstalling the same Elixir/Erlang version, and yet mix compile still fails to compile ranch. 🤔

EDIT:

The thing that solved it for me was mix deps.clean ranch (or --all if you want to do it for every dep). I had tried mix clean --deps a few times, but I didn't realize that the fetched deps/ranch files would be the issue; I had assumed it'd be the _build/ranch files. I also thought it was a weird coincidence that each instance of this error seems to only happen with ranch:

Anyway, disregard me! 😅

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

No branches or pull requests

7 participants