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

Ferenc Holzhauser <>
Fri Jan 24 19:44:27 CET 2014


Hi,

Thanks again for your insights and concerns.

Configuration change was an (apparently bad) example that I thought was
close enough to my case that is a bit more extensive to explain.
I didn't think it was relevant for what I was curious about and didn't want
to bore the list with it.
I've done some testing including system start and code (re)load an it did
what I need without issues

What actually triggered me to ask the  list is that it has been marked
experimental since R13B03 (a bit over 4 years now),

Perhaps my real questions should have been: Is this feature being looked
at? Is there any intention to remove the experimental mark one day?

Regards,
Ferenc




On 24 January 2014 19:16, José Valim <>wrote:

> 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.
> YMMV.
>
>
>
> *José Valim*
> www.plataformatec.com.br
> Skype: jv.ptec
> Founder and Lead Developer
>
>
> On Fri, Jan 24, 2014 at 6:58 PM, Jachym Holecek <>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
>> EXPERIMENTAL
>> 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
>> 
>> http://erlang.org/mailman/listinfo/erlang-questions
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20140124/9140ee80/attachment.html>


More information about the erlang-questions mailing list