on_load behaviour in OTP 20

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

on_load behaviour in OTP 20

Caragea Silviu
Hello,

In some of my projects I have modules dynamically compiled. In order to avoid static analyzers warning I had used a stub module. And also in order to avoid when doing hot-swap releases to have the stubs reloaded and overwriting the code I used on_load that returns something different than ok.

Unfortunatly this seems no longer working in OTP 20 as time : In embedded mode, first all modules are loaded. Then all on_load functions are called. The system is terminated unless all of the on_load functions return ok.

My stub is as follow:

-module(erlpool_globals).

%% Module stub.
%% Will be replaced by the module with the same name at runtime.
%% The only purpose for the module is to suppress warnings from code analyzers,
%% as dynamically compiled module is not available during the build.

-export([]).

-on_load(do_not_load/0).

do_not_load() ->
do_not_load.
In OTP < 20 works fine. In 20 is not. The app crashes at startup if the relase is done using 
{profile, standalone}, or {profile, embedded}

Any workarounds ?

Silviu

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: on_load behaviour in OTP 20

Caragea Silviu
Sorry profile doesn't matter. The one that meters is Code Loading Strategy : In OTP < 20 both -mode interactive and -mode embedded works In OTP20 only -mode interactive works

Silviu


On Sat, Jul 8, 2017 at 9:21 PM, Caragea Silviu <[hidden email]> wrote:
Hello,

In some of my projects I have modules dynamically compiled. In order to avoid static analyzers warning I had used a stub module. And also in order to avoid when doing hot-swap releases to have the stubs reloaded and overwriting the code I used on_load that returns something different than ok.

Unfortunatly this seems no longer working in OTP 20 as time : In embedded mode, first all modules are loaded. Then all on_load functions are called. The system is terminated unless all of the on_load functions return ok.

My stub is as follow:

-module(erlpool_globals).

%% Module stub.
%% Will be replaced by the module with the same name at runtime.
%% The only purpose for the module is to suppress warnings from code analyzers,
%% as dynamically compiled module is not available during the build.

-export([]).

-on_load(do_not_load/0).

do_not_load() ->
do_not_load.
In OTP < 20 works fine. In 20 is not. The app crashes at startup if the relase is done using 
{profile, standalone}, or {profile, embedded}

Any workarounds ?

Silviu


_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Loading...