應用程序時,我已經創建使用poolboy幾乎空工人簡單的應用程序,但是當我停止應用程序,我看到啤酒印刷以下錯誤:奇怪的錯誤消息,停止使用啤酒和poolboy
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
Poolboy:1.0.1
拉格:在寫的問題(822062478a223313dce30e5a45e30a50a4b7dc4e)
我從來沒有聽說過poolboy,但從他們的網站上的例子來看,你似乎需要在worker中實現'poolboy_worker'行爲,不是嗎? – akonsu
我用-behaviour(poolboy_worker)試過 - 沒有幫助。更新後的源代碼。 –
我也遇到這個問題;看起來好像它已經在Poolboy中修復了,保羅的建議是刪除鏈接讓我有點煩惱... – Seb