2 ms·
Beware the risks of using NIFs with Elixir. They run in the same memory space as the BEAM and can crash not just the process but the entire BEAM. Granted, wel
by Dowwie 2y ago
Beware the risks of using NIFs with Elixir. They run in the same memory space as the BEAM and can crash not just the process but the entire BEAM. Granted, well-written, safe Rust could lower the chances of this happening, but you need to consider the risk.
- mijoharas 2y agoI believe that by using rustler[0] to build the bindings that shouldn't be possible. (at the very least that's stated in the readme.) > Safety : The code you write in a Rust NIF should never be able to crash the BEAM. I tried to find some documentation stating how it works but couldn't. I think they use a dirty scheduler, and catch panics at the boundaries or something? wasn't able to find a clear reference. [0] https://github.com/rusterlium/rustler https://github.com/rusterlium/rustler
- junon 2y agoI have no evidence of this but they may be liberally using catch_unwind: https://doc.rust-lang.org/std/panic/fn.catch_unwind.html https://doc.rust-lang.org/std/panic/fn.catch_unwind.html