简体   繁体   中英

Rebar3 + Cowboy Kernel PID Terminated

I installed rebar3 and created a new release with

cd ~/apps rebar3 new release tunnel

Then

I copied my src files from ~/tunnel/src/* to ~/apps/tunnel/src/

I ran into a compile error with rebar3 run and found Erlang "Kernel pid terminated" error as a possible solution. I renamed everything about tunnel_app to tunnel . So my src contains tunnel.erl , tunnel.app.src and tunnel_sup.erl . I renamed the module definition as appropriate.

Here's the rebar3 run error:

~/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

Why is this crashing?

If this is your first experience with rebar3, I suggest starting with an OTP application, not an OTP release:

rebar3 new app tunnel

and then do not blindly copy over the source files because you risk overwriting the files that have been created for you below src . Have a look at the contents of that directory beforehand.

I also suggest to take the time to read the rebar3 https://www.rebar3.org/docs/basic-usage page.

You will also have to read about what an OTP application is. I know, quite a lot to understand and sometimes confusing. A free source is 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 .

There is also an online course, free, that starts in a few days (20th Feb 2017) https://www.mooc-list.com/course/functional-programming-erlang-futurelearn

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM