0

Environment

Mac OS X 10.10.5
Erlang/OTP: 17.5
rebar 2.6.0 17 20150818_094957 git 2.6.0-16-g3239e74-dirty

It is an example of application from the book Programming Erlang. I have git push to github

Steps to reproduce the error

build

$ git clone https://github.com/mingchaoyan/sellaprime.git ... $ cd sellaprime $ rebar prepare-deps ... $ rebar compile ...

release

$ mkdir rel $ cd rel $ rebar create-node nodeid=sp ... edit reltool.config as follow

```
%% -*- mode: erlang -*-
%% ex: ft=erlang
{sys, [
       {lib_dirs, []},
       {erts, [{mod_cond, derived}, {app_file, strip}]},
       {app_file, strip},
       {rel, "sp", "1.0.0",
        [
         kernel,
         stdlib,
         sasl,
         goldrush,
         lager,
         sp
        ]},
       {rel, "start_clean", "",
        [
         kernel,
         stdlib
        ]},
       {boot_rel, "sp"},
       {profile, embedded},
       {incl_cond, derived},
       {excl_archive_filters, [".*"]}, %% Do not archive built libs
       {excl_sys_filters, ["^bin/(?!start_clean.boot)",
                           "^erts.*/bin/(dialyzer|typer)",
                           "^erts.*/(doc|info|include|lib|man|src)"]},
       {excl_app_filters, ["\.gitignore"]},
       {app, goldrush, [{mod_cond, app}, {incl_cond, include}, {lib_dir, "../deps/goldrush"}]},
       {app, lager, [{mod_cond, app}, {incl_cond, include}, {lib_dir, "../deps/lager"}]},
       {app, sp, [{mod_cond, app}, {incl_cond, include}, {lib_dir, ".."}]}
      ]}.

{target_dir, "sp"}.

{overlay, [
           {mkdir, "log/sasl"},
           {copy, "files/erl", "\{\{erts_vsn\}\}/bin/erl"},
           {copy, "files/nodetool", "releases/\{\{rel_vsn\}\}/nodetool"},
           {copy, "sp/bin/start_clean.boot",
                  "\{\{erts_vsn\}\}/bin/start_clean.boot"},
           {copy, "files/sp", "bin/sp"},
           {copy, "files/sp.cmd", "bin/sp.cmd"},
           {copy, "files/start_erl.cmd", "bin/start_erl.cmd"},
           {copy, "files/sys.config", "releases/\{\{rel_vsn\}\}/sys.config"},
           {copy, "files/vm.args", "releases/\{\{rel_vsn\}\}/vm.args"}
          ]}.
```

then $ rebar generate ...

start

$ cd sp $ ./bin/sp start $ ./bin/sp getpid ... $ ./bin/sp attach

start an another erlang shell

erl -name 'other@127.0.0.1' -noinput -noshell -eval "rpc:call('sp@127.0.0.1', init, restart, [])" -setcookie sp

then the first erlang shell will report

sp@127.0.0.1)1> {"init terminating in do_boot",{'cannot load',asn1rt_nif,get_files}}

How this happened?

And why asn1rt will be released, actually I didn't config it in reltool.config

Thank you!

mingchaoyan
  • 8,096
  • 3
  • 23
  • 31

1 Answers1

0

You can find an answer in this old rebar issue: you need to prevent the boot script from loading the crypto module. To do this, edit the sp/bin/sp script and remove -mode embedded from the CMD variable setting, changing this:

CMD="$BINDIR/erlexec $SLIM_ARGS -boot $RUNNER_BASE_DIR/releases/$APP_VSN/$BOOTFILE -mode embedded -config $CONFIG_PATH -args_file $VMARGS_PATH"

to this:

CMD="$BINDIR/erlexec $SLIM_ARGS -boot $RUNNER_BASE_DIR/releases/$APP_VSN/$BOOTFILE -config $CONFIG_PATH -args_file $VMARGS_PATH"
Steve Vinoski
  • 19,847
  • 3
  • 31
  • 46