简体   繁体   中英

Erlang “Kernel pid terminated” error

I try to use relx for release application. Relx did it without problems. But when I start application, I have the error:

{"Kernel pid terminated",application_controller,"
{application_start_failure,iqServer,{bad_return,{{iqServer_app,start,[normal,[]]},  
{'EXIT',{undef,[{iqServer_app,start,[normal,[]],[]},
{application_master,start_it_old,4,[{file,\"application_master.erl\"},
{line,272}]}]}}}}}"}

As I understand from the error, I have a problem in the function iqServer:start/2 . start/2 looks like that:

-module(iqServer).
-behaviour(application).

-export([start/2, stop/1]).

start(_StartType, _StartArgs) ->
    Dispatch = dispatch_rules(),
    {ok, _} = cowboy:start_http(http_listener, 100, [
        {ip,{127,0,0,1}}, 
        {port, 6000}], [
        {env, [{dispatch, Dispatch}]}
    ]),
    iqServer_sup:start_link().

stop(_State) ->
    ok.

dispatch_rules() ->
    cowboy_router:compile([
        {'_', [
            {"/test/", cowboy_static, {file, "priv/index.html"}},
            {"/test/:group/:method", iqServer_test_handler, []}
        ]}
    ]).

Previously I started my application by this command: erl -pa ebin deps/*/ebin -s iqServer and it worked fine. And now I don't know where trouble is.

This is my iqServer.app.src file:

{application, iqServer,
 [
  {description, "Test app"},
  {vsn, "0.1"},
  {registered, [iqServer]},
  {applications, [
                  kernel,
                  stdlib,
                  crypto,
                  cowlib,
                  ranch,
                  gproc,
                  cowboy
                 ]},
  {mod, { iqServer_app, []}},
  {modules, [
      iqServer,
      .....
      iqServer_sup,
      iqServer_tools
      ]}
 ]}.

Makefile:

PROJECT = iqServer

DEPS = cowboy sync gproc jsx epgsql
COMPILE_FIRST = iqServer_api_method
ERLC_OPTS = +debug_info
dep_cowboy = git https://github.com/ninenines/cowboy.git HEAD
dep_gproc = git git://github.com/esl/gproc.git HEAD
dep_jsx = git git://github.com/talentdeficit/jsx.git HEAD
dep_epgsql = git git://github.com/epgsql/epgsql.git HEAD

include erlang.mk

relx.config:

{release, {iqServer, "1"}, [iqServer]}.

{extended_start_script, true}.
{sys_config, "rel/sys.config"}.

{vm_args, "rel/vm.args"}.

In your app file, you have this line:

  {mod, { iqServer_app, []}},

That means that when starting the application, the start/2 function in the iqServer_app module should be called. However, your application callback module is called iqServer . Either change the module name in the app file, or rename the module.

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