Closed hazardfn closed 4 years ago
I managed to reproduce this on 387fd8a (rustler-0.22.0-rc.0) as well as on the current master 427da64. Running mix test
in rustler_tests
:
~/tools/rustler/rustler_tests(387fd8a ✗) mix test
Compiling NIF crate :binary_example (native/binary_example)...
Finished dev [unoptimized + debuginfo] target(s) in 0.00s
Compiling NIF crate :rustler_test (native/rustler_test)...
Finished dev [unoptimized + debuginfo] target(s) in 0.01s
Compiling NIF crate :deprecated_macros (native/deprecated_macros)...
Finished dev [unoptimized + debuginfo] target(s) in 0.01s
21:01:37.982 [error] Process #PID<0.242.0> raised an exception
** (ArgumentError) argument error
:erlang.load_nif(:erlang, :apply)
(rustler_test 0.0.1) lib/rustler_test.ex:6: RustlerTest.__init__/0
(kernel 7.0) code_server.erl:1355: anonymous fn/1 in :code_server.handle_on_load/5
21:01:38.009 [warn] The on_load function for module Elixir.RustlerTest returned:
{:badarg, [{:erlang, :load_nif, [:erlang, :apply], []}, {RustlerTest, :__init__, 0, [file: 'lib/rustler_test.ex', line: 6]}, {:code_server, :"-handle_on_load/5-fun-0-", 1, [file: 'code_server.erl', ...]}]}
21:01:37.993 [warn] The on_load function for module Elixir.RustlerTest returned:
{:error, {:reload, 'NIF library already loaded (reload disallowed since OTP 20).'}}
This doesn't happen every time, but it happens often enough. When the above happens, the tests hang here.
EDIT: This is not the same message as in the description of this issue (it doesn't error out in asn1rt
here), but I think the cause is related. asn1rt
is a module within OTP.
This OTP issue here seems related.
https://github.com/erlang/otp/pull/2649 this might fix the problem.
@evnu I'll install erlang maint and get back to you, though I suspect given your speed getting back on these things, you're already on it 😆
I built OTP maint with kerl and cannot reproduce the issue anymore with mix test
.
I also ran mix test in a loop for some time (+ stress -c8), no hang-ups happened anymore. I will close the issue here. @hazardfn thanks for the report! Feel free to reopen if you encounter the problem again.
This should be fixed as of OTP 23.0.3
Sometimes when switching between branches, running mix deps.get and then compiling this error pops up:
It doesn't seem to cause any immediate/noticeable issues and started happening for me when using OTP 23.0. The thing that stands out to me is the arguments to
load_nif/2
look completely wrong(:erlang, :apply)
The error comes from the
use Rustler
macro line hence why I am reporting it here, some changes to NIFs were bought into 23.0 but nothing that was supposed to break compatibility as far as I know. One thing that could be related is: https://github.com/erlang/otp/commit/a4e8656d1aa4bde0bbfab6a52585add5d7951bd1