[erlang-questions] recover from unexpected errors from inside NIF

Gleb Peregud <>
Tue Aug 10 11:29:09 CEST 2010


AFAIk there is no good way to recover from unexpected errors inside
NIFs. You have to make sure to handle manually all extreme cases
inside NIF's code, because NIFs are run directly in scheduler thread
of BEAM, so any errors can crash whole BEAM.

If you have some unstable library and there is no way to make it
stable, I'd suggest using it through external program connected to
Erlang via port mechanism.

On Mon, Aug 9, 2010 at 22:15, Saurabh Narula
<> wrote:
> Hello Everyone,
>
> I am writing a gen server that makes use of certain native implemented
> functions (NIFs) that I have written in C, can anybody tell me how to
> recover from unexpected errors that might happen in my C program where my C
> program tends to crash at the OS level?
>
> Would appreciate any kind help!
>
> Saurabh
>


More information about the erlang-questions mailing list