Rebar3 + Cowboy 内核 PID 终止
Rebar3 + Cowboy Kernel PID Terminated
我安装了 rebar3
并使用
创建了一个新版本
cd ~/apps
rebar3 new release tunnel
然后
我将 src
文件从 ~/tunnel/src/*
复制到 ~/apps/tunnel/src/
我 运行 使用 rebar3 run
进入编译错误,并找到 作为可能的解决方案。我将 tunnel_app
的所有内容重命名为 tunnel
。所以我的 src
包含 tunnel.erl
、 tunnel.app.src
和 tunnel_sup.erl
。我适当地重命名了模块定义。
这是 rebar3 run
错误:
~/apps/tunnel:.rebar3 run
===> Verifying dependencies...
===> Compiling tunnel
===> Starting relx build process ...
===> Resolving OTP Applications from directories:
/Users/quantum/apps/tunnel/_build/default/lib
/Users/quantum/apps/tunnel/apps
/usr/local/Cellar/erlang/19.2/lib/erlang/lib
/Users/quantum/apps/tunnel/_build/default/rel
===> Resolved tunnel-0.1.0
===> Dev mode enabled, release will be symlinked
===> release successfully created!
readlink: illegal option -- f
usage: readlink [-n] [file ...]
Exec: /usr/local/Cellar/erlang/19.2/lib/erlang/erts-8.2/bin/erlexec -boot /Users/quantum/apps/tunnel/_build/default/rel/tunnel/releases/0.1.0/tunnel -mode embedded -boot_var ERTS_LIB_DIR /usr/local/Cellar/erlang/19.2/lib/erlang/lib -config /Users/quantum/apps/tunnel/_build/default/rel/tunnel/releases/0.1.0/sys.config -args_file /Users/quantum/apps/tunnel/_build/default/rel/tunnel/releases/0.1.0/vm.args -pa -- console
Root: /Users/quantum/apps/tunnel/_build/default/rel/tunnel
/Users/quantum/apps/tunnel/_build/default/rel/tunnel
Erlang/OTP 19 [erts-8.2] [source] [64-bit] [smp:8:8] [async-threads:30] [hipe] [kernel-poll:true] [dtrace]
=INFO REPORT==== 16-Feb-2017::15:02:21 ===
application: tunnel
exited: {bad_return,
{{tunnel,start,[normal,[]]},
{'EXIT',
{undef,
[{cowboy_router,compile,
[[{'_',
[{"/info",lobby_handler,[]},
{"/join/:name",join_handler,[]},
{"/play/:table_pid/:name/:auth/:team/:action/:x/:y",
play_handler,[]}]}]],
[]},
{tunnel,start,2,
[{file,
"/Users/quantum/apps/tunnel/_build/default/lib/tunnel/src/tunnel.erl"},
{line,8}]},
{application_master,start_it_old,4,
[{file,"application_master.erl"},
{line,273}]}]}}}}
type: permanent
{"Kernel pid terminated",application_controller,"{application_start_failure,tunnel,{bad_return,{{tunnel,start,[normal,[]]},{'EXIT',{undef,[{cowboy_router,compile,[[{'_',[{\"/info\",lobby_handler,[]},{\"/join/:name\",join_handler,[]},{\"/play/:table_pid/:name/:auth/:team/:action/:x/:y\",play_handler,[]}]}]],[]},{tunnel,start,2,[{file,\"/Users/quantum/apps/tunnel/_build/default/lib/tunnel/src/tunnel.erl\"},{line,8}]},{application_master,start_it_old,4,[{file,\"application_master.erl\"},{line,273}]}]}}}}}"}
Kernel pid terminated (application_controller) ({application_start_failure,tunnel,{bad_return,{{tunnel,start,[normal,[]]},{'EXIT',{undef,[{cowboy_router,compile,[[{'_',[{"/info",lobby_handler,[]},{"/j
Crash dump is being written
为什么会崩溃?
如果这是您第一次使用 rebar3,我建议您从 OTP 应用程序开始,而不是 OTP 版本:
rebar3 new app tunnel
然后不要盲目复制源文件,因为您可能会覆盖在 src
下面为您创建的文件。事先看一下那个目录的内容。
我还建议花时间阅读 rebar3 https://www.rebar3.org/docs/basic-usage 页面。
您还必须了解什么是 OTP 应用程序。我知道,有很多东西需要理解,有时还会令人困惑。免费资源是 http://learnyousomeerlang.com/building-applications-with-otp. It is also worthwhile to buy a book about Erlang. There are a few, I suggest https://www.manning.com/books/erlang-and-otp-in-action.
几天后(2017 年 2 月 20 日)还有一个免费的在线课程https://www.mooc-list.com/course/functional-programming-erlang-futurelearn
我安装了 rebar3
并使用
cd ~/apps
rebar3 new release tunnel
然后
我将 src
文件从 ~/tunnel/src/*
复制到 ~/apps/tunnel/src/
我 运行 使用 rebar3 run
进入编译错误,并找到 tunnel_app
的所有内容重命名为 tunnel
。所以我的 src
包含 tunnel.erl
、 tunnel.app.src
和 tunnel_sup.erl
。我适当地重命名了模块定义。
这是 rebar3 run
错误:
~/apps/tunnel:.rebar3 run
===> Verifying dependencies...
===> Compiling tunnel
===> Starting relx build process ...
===> Resolving OTP Applications from directories:
/Users/quantum/apps/tunnel/_build/default/lib
/Users/quantum/apps/tunnel/apps
/usr/local/Cellar/erlang/19.2/lib/erlang/lib
/Users/quantum/apps/tunnel/_build/default/rel
===> Resolved tunnel-0.1.0
===> Dev mode enabled, release will be symlinked
===> release successfully created!
readlink: illegal option -- f
usage: readlink [-n] [file ...]
Exec: /usr/local/Cellar/erlang/19.2/lib/erlang/erts-8.2/bin/erlexec -boot /Users/quantum/apps/tunnel/_build/default/rel/tunnel/releases/0.1.0/tunnel -mode embedded -boot_var ERTS_LIB_DIR /usr/local/Cellar/erlang/19.2/lib/erlang/lib -config /Users/quantum/apps/tunnel/_build/default/rel/tunnel/releases/0.1.0/sys.config -args_file /Users/quantum/apps/tunnel/_build/default/rel/tunnel/releases/0.1.0/vm.args -pa -- console
Root: /Users/quantum/apps/tunnel/_build/default/rel/tunnel
/Users/quantum/apps/tunnel/_build/default/rel/tunnel
Erlang/OTP 19 [erts-8.2] [source] [64-bit] [smp:8:8] [async-threads:30] [hipe] [kernel-poll:true] [dtrace]
=INFO REPORT==== 16-Feb-2017::15:02:21 ===
application: tunnel
exited: {bad_return,
{{tunnel,start,[normal,[]]},
{'EXIT',
{undef,
[{cowboy_router,compile,
[[{'_',
[{"/info",lobby_handler,[]},
{"/join/:name",join_handler,[]},
{"/play/:table_pid/:name/:auth/:team/:action/:x/:y",
play_handler,[]}]}]],
[]},
{tunnel,start,2,
[{file,
"/Users/quantum/apps/tunnel/_build/default/lib/tunnel/src/tunnel.erl"},
{line,8}]},
{application_master,start_it_old,4,
[{file,"application_master.erl"},
{line,273}]}]}}}}
type: permanent
{"Kernel pid terminated",application_controller,"{application_start_failure,tunnel,{bad_return,{{tunnel,start,[normal,[]]},{'EXIT',{undef,[{cowboy_router,compile,[[{'_',[{\"/info\",lobby_handler,[]},{\"/join/:name\",join_handler,[]},{\"/play/:table_pid/:name/:auth/:team/:action/:x/:y\",play_handler,[]}]}]],[]},{tunnel,start,2,[{file,\"/Users/quantum/apps/tunnel/_build/default/lib/tunnel/src/tunnel.erl\"},{line,8}]},{application_master,start_it_old,4,[{file,\"application_master.erl\"},{line,273}]}]}}}}}"}
Kernel pid terminated (application_controller) ({application_start_failure,tunnel,{bad_return,{{tunnel,start,[normal,[]]},{'EXIT',{undef,[{cowboy_router,compile,[[{'_',[{"/info",lobby_handler,[]},{"/j
Crash dump is being written
为什么会崩溃?
如果这是您第一次使用 rebar3,我建议您从 OTP 应用程序开始,而不是 OTP 版本:
rebar3 new app tunnel
然后不要盲目复制源文件,因为您可能会覆盖在 src
下面为您创建的文件。事先看一下那个目录的内容。
我还建议花时间阅读 rebar3 https://www.rebar3.org/docs/basic-usage 页面。
您还必须了解什么是 OTP 应用程序。我知道,有很多东西需要理解,有时还会令人困惑。免费资源是 http://learnyousomeerlang.com/building-applications-with-otp. It is also worthwhile to buy a book about Erlang. There are a few, I suggest https://www.manning.com/books/erlang-and-otp-in-action.
几天后(2017 年 2 月 20 日)还有一个免费的在线课程https://www.mooc-list.com/course/functional-programming-erlang-futurelearn