/safe_exec_env

A safe(r) way to run native code bindings which may crash on the BEAM

Primary LanguageElixirApache License 2.0Apache-2.0

SafeExecEnv

It is often desirable to run natively compiled code (C, C++, Rust, ..) from a BEAM application via a binding. The motivation may be better performance or simply to access an external library that already exists. The problem is that if that native code crashes then, unlike with native BEAM processes, the entire VM will crash, taking your application along with it.

SafeExecEnv provides a safe(r) way to run natively compiled code from a BEAM application. If the native code in question can be reasonably expected to never crash, then this precaution is unecessary, but if native code that might crash is being run then this library provides a layer of insulation between the code being executed and the virtual machine the main application is being run on.

Installation

The package can be installed by adding safe_exec_env to your list of dependencies in mix.exs:

def deps do
  [
    {:safe_exec_env, "~> 0.1.1"}
  ]
end

Docs can be found at https://hexdocs.pm/safe_exec_env.