我使用 poolboy 创建了一个简单的应用程序,工作人员几乎是空的,但是当我停止应用程序时,我看到 lager 打印了以下错误:
10:50:26.363 [error] Supervisor {<0.236.0>,poolboy_sup} had child test_worker started with test_worker:start_link([]) at undefined exit with reason shutdown in context shutdown_error
是什么导致了这个错误,我该如何解决这个问题?
导师:
-module(test_sup).
-behaviour(supervisor).
-export([start_link/0, init/1]).
start_link() ->
supervisor:start_link({local, ?MODULE}, ?MODULE, []).
init([]) ->
ChildSpecs = [pool_spec()],
{ok, {{one_for_one, 1000, 3600}, ChildSpecs}}.
pool_spec() ->
Name = test_pool,
PoolArgs = [{name, {local, Name}},
{worker_module, test_worker},
{size, 10},
{max_overflow, 20}],
poolboy:child_spec(Name, PoolArgs, []).
工人:
-module(test_worker).
-behaviour(gen_server).
-behaviour(poolboy_worker).
-export([start_link/1]).
-export([init/1, handle_call/3, handle_cast/2,
handle_info/2, terminate/2, code_change/3]).
-record(state, {}).
start_link([]) ->
gen_server:start_link(?MODULE, [], []).
init([]) ->
{ok, #state{}}.
handle_call(_Request, _From, State) ->
{reply, _Reply = ok, State}.
handle_cast(_Msg, State) ->
{noreply, State}.
handle_info(_Info, State) ->
{noreply, State}.
terminate(_Reason, _State) ->
ok.
code_change(_OldVsn, State, _Extra) ->
{ok, State}.
应用程序的其余部分非常标准。
二郎:R16B02
台球男孩:1.0.1
Lager:撰写问题时大师的最新版本(822062478a223313dce30e5a45e30a50a4b7dc4e)