problems with rebar3 releases and on_load functions

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

problems with rebar3 releases and on_load functions

Caragea Silviu
Hello,

I have a project that compiles ok using both rebar and rebar3, also works ok with both If I start it from command line like:

erl -pa _build/default/lib/*/ebin -config _build/configs/app.config

But is not starting with a rebar3 release.

I'm getting a crash like:

=erl_crash_dump:0.3
Thu Oct 11 12:55:14 2018
Slogan: Kernel pid terminated (application_controller) ({application_start_failure,kernel,{{shutdown,{failed_to_start_child,kernel_safe_sup,{on_load_function_failed,erlpool_globals}}},{kernel,start,[normal,[]
System version: Erlang/OTP 19 [erts-8.3.5.5] [source] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:true] [dtrace]
Compiled: Sat Aug 11 23:57:43 2018

The erlpool_globals code is : https://github.com/silviucpp/erlpool/blob/master/src/erlpool_globals.erl . Basically it's just a stub module that's compiled dynamically and replace at runtime . I created this to avoid static code analyzer errors in IntelliJ.

Also it's strange because if I change do_not_load() to return ok it's working :)

Any hints ?

Silviu


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

Re: problems with rebar3 releases and on_load functions

Gleb Vinogradov


чт, 11 окт. 2018 г. в 17:06, Caragea Silviu <[hidden email]>:

Also it's strange because if I change do_not_load() to return ok it's working :)


Nothing strange at all. It's documented behaviour: http://erlang.org/doc/reference_manual/code_loading.html
"The function must return ok if the module is to become the new current code for the module and become callable. "

Gleb

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

Re: problems with rebar3 releases and on_load functions

Loïc Hoguin-3
In reply to this post by Caragea Silviu
Presumably your rebar release is using interactive mode (your module
isn't loaded at startup) while your rebar3 release is using embedded
mode (your mode is loaded at startup).

On 10/11/18 12:06 PM, Caragea Silviu wrote:

> Hello,
>
> I have a project that compiles ok using both rebar and rebar3, also
> works ok with both If I start it from command line like:
>
> erl -pa _build/default/lib/*/ebin -config _build/configs/app.config
>
> But is not starting with a rebar3 release.
>
> I'm getting a crash like:
>
> =erl_crash_dump:0.3
> Thu Oct 11 12:55:14 2018
> Slogan: Kernel pid terminated (application_controller)
> ({application_start_failure,kernel,{{shutdown,{failed_to_start_child,kernel_safe_sup,{on_load_function_failed,erlpool_globals}}},{kernel,start,[normal,[]
> System version: Erlang/OTP 19 [erts-8.3.5.5] [source] [64-bit] [smp:8:8]
> [async-threads:10] [hipe] [kernel-poll:true] [dtrace]
> Compiled: Sat Aug 11 23:57:43 2018
>
> The erlpool_globals code is :
> https://github.com/silviucpp/erlpool/blob/master/src/erlpool_globals.erl 
> . Basically it's just a stub module that's compiled dynamically and
> replace at runtime . I created this to avoid static code analyzer errors
> in IntelliJ.
>
> Also it's strange because if I change do_not_load() to return ok it's
> working :)
>
> Any hints ?
>
> Silviu
>
>
> _______________________________________________
> erlang-questions mailing list
> [hidden email]
> http://erlang.org/mailman/listinfo/erlang-questions
>

--
Loïc Hoguin
https://ninenines.eu
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions