Open aleklisi opened 2 years ago
rebar3.crashdump file:
Error: undef
[{epp,open,
["/Users/aleksanderlisiecki/Documents/Erlang/eneo4j/src/eneo4j.erl",
<0.1258.0>,
{1,1},
[],[]],
[]},
{gradualizer_file_utils,epp_parse_file,2,
[{file,"/Users/aleksanderlisiecki/Documents/Erlang/eneo4j/_build/default/plugins/gradualizer/src/gradualizer_file_utils.erl"},
{line,40}]},
{gradualizer_file_utils,get_forms_from_erl,2,
[{file,"/Users/aleksanderlisiecki/Documents/Erlang/eneo4j/_build/default/plugins/gradualizer/src/gradualizer_file_utils.erl"},
{line,25}]},
{gradualizer,type_check_file,2,
[{file,"/Users/aleksanderlisiecki/Documents/Erlang/eneo4j/_build/default/plugins/gradualizer/src/gradualizer.erl"},
{line,61}]},
{gradualizer,'-type_check_files/2-fun-1-',4,
[{file,"/Users/aleksanderlisiecki/Documents/Erlang/eneo4j/_build/default/plugins/gradualizer/src/gradualizer.erl"},
{line,133}]},
{lists,foldl,3,[{file,"lists.erl"},{line,1350}]},
{lists,map,2,[{file,"lists.erl"},{line,1315}]},
{rebar_prv_gradualizer,do,1,
[{file,"/Users/aleksanderlisiecki/Documents/Erlang/eneo4j/_build/default/plugins/gradualizer/src/rebar_prv_gradualizer.erl"},
{line,27}]}]
Yeah, I think we are relying on an undocumented eep:open/5
which might have been removed. I think @gomoripeti has been involved in this part both in Gradualizer and in OTP. Is that right?
wow Viktor, you have better memory then I have. Indeed gradualizer was using this undocumented epp function to have column numbers on the parsed abstract format.
I wonder if the compiler API could be used instead with modern OTP versions something like compile:file("module", [binary, 'P', return])
. I think there was a change in attitude of Gradualizer that back then it was expected to handle source code with compiler errors but now it is assumed that source code must compile.
Or epp:open/1
now supports location
option since OTP 24. https://www.erlang.org/doc/man/epp.html#open-1
I think the PR that removed epp:open/5 enabled column numbers in epp https://github.com/erlang/otp/pull/3006/files#diff-580a349c49b1d9b5415166e18f5279728d934efe0cebc4ee5a87823055ec3413?
Thx Peti. Interestingly, we already conditionally use eep:open/5
or eep:open/1
. See https://github.com/josefs/Gradualizer/blob/master/src/gradualizer_file_utils.erl#L60
@aleklisi which version of Gradualizer are you using?
@zuiderkwast I use gradualizer (0.1.3)
according to rebar3.
eneo4j$ rebar3 plugins list
--- Global plugins ---
rebar3_nova (0.3.3)
rebar3_hex (6.11.3)
rebar3_grisp (2.2.2)
--- Local plugins ---
erlfmt (1.0.0)
gradualizer (0.1.3)
rebar3_codecov (0.3.0)
rebar3_hex (7.0.2)
rebar3_ex_doc (0.2.11)
And this is how I defined it in the rebar.config
file:
https://github.com/aleklisi/eneo4j/blob/master/rebar.config#L17
OK, 0.1.3 doesn't have this logic. (See https://github.com/josefs/Gradualizer/blob/0.1.3/src/gradualizer_file_utils.erl#L35)
I tried updating to use the current gradualizer's master:
eneo4j$ rebar3 plugins list
--- Global plugins ---
rebar3_nova (0.3.3)
rebar3_hex (6.11.3)
rebar3_grisp (2.2.2)
--- Local plugins ---
erlfmt (1.0.0)
gradualizer (0.1.3+build.1112.ref6fe5a67)
rebar3_codecov (0.3.0)
rebar3_hex (7.0.2)
rebar3_ex_doc (0.2.11)
but I get another issue and the issue now is that:
eneo4j$ rebar3 gradualizer
===> Verifying dependencies...
===> Analyzing applications...
===> Compiling eneo4j
/Users/aleksanderlisiecki/Documents/Erlang/eneo4j/src/eneo4j_worker.erl: Timeout checking function send_request_and_process_response/4 on line 148 at column 1
This is most likely a bug in Gradualizer.
Please report it at https://github.com/josefs/Gradualizer/issues
===> Gradualizer found errors.
And here are more details:
eneo4j$ DEBUG=1 rebar3 gradualizer
===> Load global config file /Users/aleksanderlisiecki/.config/rebar3/rebar.config
===> Compile (apps)
===> Evaluating config script "/Users/aleksanderlisiecki/.cache/rebar3/plugins/rebar3_erlydtl_plugin/rebar.config.script"
===> Evaluating config script "/Users/aleksanderlisiecki/.cache/rebar3/plugins/erlydtl/rebar.config.script"
===> Compile (apps)
===> Evaluating config script "/Users/aleksanderlisiecki/.cache/rebar3/plugins/erlydtl/rebar.config.script"
===> 25.0 satisfies the requirement for minimum OTP version 18
===> Evaluating config script "/Users/aleksanderlisiecki/.cache/rebar3/plugins/hex_core/rebar.config.script"
===> Compile (apps)
===> Compile (apps)
===> 25.0 satisfies the requirement for minimum OTP version 18
===> Evaluating config script "/Users/aleksanderlisiecki/.cache/rebar3/plugins/hex_core/rebar.config.script"
===> Compile (apps)
===> Not adding provider hex user from module rebar3_hex_user because it already exists from module rebar3_hex_user
===> Not adding provider hex cut from module rebar3_hex_cut because it already exists from module rebar3_hex_cut
===> Not adding provider hex key from module rebar3_hex_key because it already exists from module rebar3_hex_key
===> Not adding provider hex owner from module rebar3_hex_owner because it already exists from module rebar3_hex_owner
===> Not adding provider hex repo from module rebar3_hex_repo because it already exists from module rebar3_hex_repo
===> Not adding provider hex docs from module rebar3_hex_docs because it already exists from module rebar3_hex_docs
===> Not adding provider hex search from module rebar3_hex_search because it already exists from module rebar3_hex_search
===> Not adding provider hex revert from module rebar3_hex_revert because it already exists from module rebar3_hex_revert
===> Not adding provider hex retire from module rebar3_hex_retire because it already exists from module rebar3_hex_retire
===> Not adding provider hex publish from module rebar3_hex_publish because it already exists from module rebar3_hex_publish
===> Compile (apps)
===> 25.0 satisfies the requirement for minimum OTP version 21.2
===> 25.0 satisfies the requirement for minimum OTP version 21
===> Compile (apps)
===> Compile (apps)
===> Evaluating config script "/Users/aleksanderlisiecki/Documents/Erlang/eneo4j/_build/default/plugins/jiffy/rebar.config.script"
===> Compile (apps)
===> Compile (apps)
===> 25.0 satisfies the requirement for minimum OTP version 18
===> Evaluating config script "/Users/aleksanderlisiecki/Documents/Erlang/eneo4j/_build/default/plugins/hex_core/rebar.config.script"
===> 25.0 satisfies the requirement for minimum OTP version 19.3
===> Compile (apps)
===> Not adding provider hex user from module rebar3_hex_user because it already exists from module rebar3_hex_user
===> Not adding provider hex cut from module rebar3_hex_cut because it already exists from module rebar3_hex_cut
===> Not adding provider hex owner from module rebar3_hex_owner because it already exists from module rebar3_hex_owner
===> Not adding provider hex search from module rebar3_hex_search because it already exists from module rebar3_hex_search
===> Not adding provider hex retire from module rebar3_hex_retire because it already exists from module rebar3_hex_retire
===> Not adding provider hex publish from module rebar3_hex_publish because it already exists from module rebar3_hex_publish
===> Compile (apps)
===> Not adding provider default ex_doc from module rebar3_ex_doc because it already exists from module rebar3_ex_doc
===> Expanded command sequence to be run: [app_discovery,install_deps,lock,compile,gradualizer]
===> Running provider: app_discovery
===> Found top-level apps: [eneo4j]
using config: [{src_dirs,["src"]},{lib_dirs,["apps/*","lib/*","."]}]
===> Evaluating config script "/Users/aleksanderlisiecki/Documents/Erlang/eneo4j/_build/default/lib/jiffy/rebar.config.script"
===> 25.0 satisfies the requirement for minimum OTP version 21.2
===> 25.0 satisfies the requirement for minimum OTP version 21
===> Compile (apps)
===> Not adding provider default fmt from module rebar3_fmt_prv because it already exists from module rebar3_fmt_prv
===> Compile (apps)
===> Not adding provider default gradualizer from module rebar_prv_gradualizer because it already exists from module rebar_prv_gradualizer
===> Evaluating config script "/Users/aleksanderlisiecki/Documents/Erlang/eneo4j/_build/default/plugins/jiffy/rebar.config.script"
===> Compile (apps)
===> Not adding provider codecov analyze from module rebar3_codecov_prv because it already exists from module rebar3_codecov_prv
===> 25.0 satisfies the requirement for minimum OTP version 18
===> Evaluating config script "/Users/aleksanderlisiecki/Documents/Erlang/eneo4j/_build/default/plugins/hex_core/rebar.config.script"
===> 25.0 satisfies the requirement for minimum OTP version 19.3
===> Compile (apps)
===> Not adding provider hex user from module rebar3_hex_user because it already exists from module rebar3_hex_user
===> Not adding provider hex build from module rebar3_hex_build because it already exists from module rebar3_hex_build
===> Not adding provider hex cut from module rebar3_hex_cut because it already exists from module rebar3_hex_cut
===> Not adding provider hex owner from module rebar3_hex_owner because it already exists from module rebar3_hex_owner
===> Not adding provider hex organization from module rebar3_hex_organization because it already exists from module rebar3_hex_organization
===> Not adding provider hex search from module rebar3_hex_search because it already exists from module rebar3_hex_search
===> Not adding provider hex retire from module rebar3_hex_retire because it already exists from module rebar3_hex_retire
===> Not adding provider hex publish from module rebar3_hex_publish because it already exists from module rebar3_hex_publish
===> Compile (apps)
===> Not adding provider default ex_doc from module rebar3_ex_doc because it already exists from module rebar3_ex_doc
===> Running provider: install_deps
===> Verifying dependencies...
===> 25.0 satisfies the requirement for minimum OTP version 21.0
===> Evaluating config script "/Users/aleksanderlisiecki/Documents/Erlang/eneo4j/_build/default/plugins/coveralls/rebar.config.script"
===> Evaluating config script "/Users/aleksanderlisiecki/Documents/Erlang/eneo4j/_build/default/plugins/jsx/rebar.config.script"
===> Compile (apps)
===> Running provider: lock
===> Running provider: compile
===> Compile (apps)
===> Running hooks for compile with configuration:
===> {pre_hooks, []}.
===> Compile (project_apps)
===> Running hooks for compile in app eneo4j (/Users/aleksanderlisiecki/Documents/Erlang/eneo4j) with configuration:
===> {pre_hooks, []}.
===> Running hooks for erlc_compile in app eneo4j (/Users/aleksanderlisiecki/Documents/Erlang/eneo4j) with configuration:
===> {pre_hooks, []}.
===> Analyzing applications...
===> Compiling eneo4j
===> compile options: {erl_opts, [debug_info]}.
===> files to analyze ["/Users/aleksanderlisiecki/Documents/Erlang/eneo4j/src/eneo4j_sup.erl",
"/Users/aleksanderlisiecki/Documents/Erlang/eneo4j/src/eneo4j_response.erl",
"/Users/aleksanderlisiecki/Documents/Erlang/eneo4j/src/eneo4j_worker.erl",
"/Users/aleksanderlisiecki/Documents/Erlang/eneo4j/src/eneo4j_app.erl",
"/Users/aleksanderlisiecki/Documents/Erlang/eneo4j/src/eneo4j.erl"]
===> Running hooks for erlc_compile in app eneo4j (/Users/aleksanderlisiecki/Documents/Erlang/eneo4j) with configuration:
===> {post_hooks, []}.
===> Running hooks for app_compile in app eneo4j (/Users/aleksanderlisiecki/Documents/Erlang/eneo4j) with configuration:
===> {pre_hooks, []}.
===> Running hooks for app_compile in app eneo4j (/Users/aleksanderlisiecki/Documents/Erlang/eneo4j) with configuration:
===> {post_hooks, []}.
===> Running hooks for compile in app eneo4j (/Users/aleksanderlisiecki/Documents/Erlang/eneo4j) with configuration:
===> {post_hooks, []}.
===> Running hooks for compile with configuration:
===> {post_hooks, []}.
===> Running provider: gradualizer
/Users/aleksanderlisiecki/Documents/Erlang/eneo4j/src/eneo4j_worker.erl: Timeout checking function send_request_and_process_response/4 on line 148 at column 1
This is most likely a bug in Gradualizer.
Please report it at https://github.com/josefs/Gradualizer/issues
===> Gradualizer found errors.
Steps to reproduce:
git clone git@github.com:aleklisi/eneo4j.git
cd eneo4j
rebar3 gradualizer
So you found another bug. Thanks for the report. Timeout looks like there is an infinite loop somewhere.
The infinite loop is caused by the recursive type returned by jiffy:decode
.
The workaround is ?assert_type(jiffy:decode(Thing), any())
.
Interestingly, we already conditionally use
eep:open/5
oreep:open/1
.
When we're at it we could also change the dynamic check to a preprocessor ifdef
. It would fix the need for https://github.com/josefs/Gradualizer/blob/51a8029e32415da66293b01611633e662673c619/gradualize-ignore.lst#L1
@aleklisi Did you have a chance to try the workaround proposed by @berbiche?
@erszcz not yet, I did not figure out where to paste this asset_type snippet yet. I will let you know if it works for me.
Gradualizer fails with:
Spotted at CI: https://github.com/aleklisi/eneo4j/runs/6830064598?check_suite_focus=true#step:7:17
More details: