rusterlium / erlang_nif-sys

Low level bindings to Erlang NIF API for Rust
Apache License 2.0
90 stars 19 forks source link

Updated to Erlang/OPT 19.0 and dirty nifs appear broken. #14

Closed nlfiedler closed 8 years ago

nlfiedler commented 8 years ago

Using Homebrew, I updated my Erlang/OTP installation to 19.0 and now I'm encountering an error with the dirty scheduler support.

Error in process <0.159.0> with exit value:
{{badmatch,{error,{bad_lib,"NIF emagick_rs:image_fit/3 requires a runtime with dirty scheduler support."}}},
 [{emagick_rs,init,0,
              [{file,"/Users/nfiedler/Downloads/emagick.rs/_build/test/lib/emagick_rs/src/emagick_rs.erl"},
               {line,51}]},
  {code_server,'-handle_on_load/5-fun-0-',1,
               [{file,"code_server.erl"},{line,1327}]}]}

Same code works with Erlang/OTP 18.3, so I'm guessing something more dramatic changed than was indicated in the 19.0 release notes for OTP-13123.

Any ideas?

goertzenator commented 8 years ago

Are you using any of these APIs?

enif_is_on_dirty_scheduler  (this one is gone)
enif_monotonic_time  (most of the rest are new for 19.0)
enif_time_offset
enif_convert_time_unit
enif_now_time
enif_cpu_time
enif_make_unique_integer
enif_is_current_process_alive
enif_is_process_alive
enif_is_port_alive
enif_get_local_port
enif_term_to_binary
enif_binary_to_term
enif_port_command
enif_thread_type
enif_snprintf
goertzenator commented 8 years ago

Hmmm. Just looking at the C code now. NIF modules compiled with 19.0 headers will unconditionally require an Erlang with dirty scheduler support. I replicated this in erlang_nif-sys, but it looks like your Erlang lacks dirty scheduler support.

nlfiedler commented 8 years ago

Ah, so it seems that Homebrew changed the default with the 19.0 release, and dirty schedulers are not included in the "bottled" build. Using brew install erlang --with-dirty-schedulers fixed the problem (albeit by building Erlang from source). Thanks for looking at this.