钢筋 ./bin/sp 重启报告 'cannot load',asn1rt_nif,get_files 并且无法启动

Posted

技术标签:

【中文标题】钢筋 ./bin/sp 重启报告 \'cannot load\',asn1rt_nif,get_files 并且无法启动【英文标题】:Rebar ./bin/sp restart report 'cannot load',asn1rt_nif,get_files and can not start钢筋 ./bin/sp 重启报告 'cannot load',asn1rt_nif,get_files 并且无法启动 【发布时间】:2015-12-02 03:34:57 【问题描述】:

环境

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

它是 Programming Erlang 一书中的一个应用示例。我有 git push 到github

重现错误的步骤

构建

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

发布

$ mkdir rel $ cd rel $ rebar create-node nodeid=sp ... 编辑 reltool.config 如下

```
%% -*- 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"
          ].
```

那么 $ rebar generate ...

开始

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

启动另一个 erlang shell

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

那么第一个 erlang shell 会报告

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

这是怎么发生的?

以及为什么会发布asn1rt,其实我并没有在reltool.config中配置

谢谢!

【问题讨论】:

【参考方案1】:

你可以在this old rebar issue找到答案:你需要阻止启动脚本加载crypto模块。为此,请编辑sp/bin/sp 脚本并从CMD 变量设置中删除-mode embedded,更改此设置:

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

到这里:

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

【讨论】:

以上是关于钢筋 ./bin/sp 重启报告 'cannot load',asn1rt_nif,get_files 并且无法启动的主要内容,如果未能解决你的问题,请参考以下文章

IDEA Cannot resolve method ‘xxx‘问题解决IDEA刷新缓存重启

IDEA Cannot resolve method ‘xxx‘问题解决IDEA刷新缓存重启

重启集群造成块丢失问题org.apache.hadoop.hdfs.CannotObtainBlockLengthException: Cannot obtain block length for L

Maven问题 不重启解决执行clean package 命令时报错——Cannot create resource output directory

Maven问题 不重启解决执行clean package 命令时报错——Cannot create resource output directory

重启集群造成块丢失问题org.apache.hadoop.hdfs.CannotObtainBlockLengthException: Cannot obtain block length for L