[erlang-questions] Is -on_load() still experimental? Anyone using it?

José Valim jose.valim@REDACTED
Fri Jan 24 19:16:13 CET 2014

Just to clarify, after Jachym's e-mail, I have been using -on_load exactly
to load NIFs and that's the scenario it has been shown to work in my case.

*José Valim*
Skype: jv.ptec
Founder and Lead Developer

On Fri, Jan 24, 2014 at 6:58 PM, Jachym Holecek <freza@REDACTED>wrote:

> Hi Ferenc,
> # Ferenc Holzhauser 2014-01-24:
> > Recently stumbled into the -on_load() directive. It seems nice to replace
> > manual work (when possible) e.g. when a live update of a library module
> > needs some environment/configuration change on the running system.
> >
> > doc:
> http://www.erlang.org/doc/reference_manual/code_loading.html#id84676
> >
> > It says it is experimental (since R13B03).
> > After trying, it appears to be doing what I think it supposed to but
> > looking at this note in the doc I'm not sure how safe it is to use in
> > production.
> >
> > Could somebody advise?
> It is clearly not safe to use in production because that's what
> means.
> Also, the -on_load() functionality has been introduced to support automatic
> NIF loading (not that this was a problem that really needed solving, IMHO).
> Have you investigated if it really fits your use case well? This snippet
> from documentation would unsettle me just a little bit on a live system:
>   "A process that calls any function in a module whose on_load function
>    has not yet returned will be suspended until the on_load function has
>    returned."
> It doesn't specify if this applies just to initial loading of a module or
> also to runtime code updates, system behaviour in the latter case could
> be disastrous.
> Further, automatic configuration changes are a touchy topic. What if some-
> thing goes wrong in the middle of your automatic update, and you end up
> with inconsistent state? How do you rollback then? Especially if the
> whole stuff is hidden where Operations won't see it?
> Personally, I'd advise to solve boring problems in boring ways...
> BR,
>         -- Jachym
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20140124/9d696837/attachment.htm>

More information about the erlang-questions mailing list