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

Sverker Eriksson <>
Mon Feb 10 19:44:33 CET 2014


On 01/28/2014 06:37 PM, Ferenc Holzhauser wrote:
> Thanks. The behaviour is quite neatly described in the documentation. If
> there is no intention to change it (which is probably the case by now) then
> perhaps it is also an idea to remove the experimental warning or replace it
> with a more appropriate one about correct use. The name of the directive is
> deceptive enough to bring the unwary to ideas and eventually make them
> break things.
>
> If well understood then it can be useful to trigger other things than NIF
> loading but I also think that the documentation should generally discourage
> that.
>
>

We will keep on_load as experimental as there are a number of known weak 
points in current semantics which we therefore might want to change but 
do not have time to do for OTP 17.0:

* Doing external call in on_load to the module itself leads to deadlock. 
This could be handled as a special case and let external calls in the 
process doing on_load reach the module itself.

* At upgrade, other processes calling the module get suspended waiting 
for on_load. We could let them reach the "old" module until 
on_load_succeeds to not destroy realtime characteristics.

* At upgrade, no rollback is done if on_load fails.  If we instead delay 
the upgrade until after on_load succeeds the system will not be left in 
a "broken" state.


/Sverker, Erlang/OTP




More information about the erlang-questions mailing list