0
我有一个Erlang supervisor
,监督一个基于gen_server
工作服务器的过程,我开始form the shell
我的主管,这反过来启动我的工作服务器没有问题,它看起来像这样:监督员崩溃时,工作人员,其中监督员不应该
start_link() ->
supervisor:start_link({local, ?SERVER}, ?MODULE, []).
但是,当我崩溃我的工作服务器,我的主管因为未知原因崩溃。
我在互联网上找到了这一个解决方法,我用这个:
start_link_shell() ->
{ok,Pid} = supervisor:start_link({local, ?SERVER}, ?MODULE, []),
unlink(Pid).
现在工作得很好,但我不明白为什么,谁能解释一下吗?
**
更新
**
这是我的初始化函数
%%%===================================================================
init([]) ->
% Building Supervisor specifications
RestartStrategy = one_for_one,
MaxRestarts = 2,
MaxSecondsBetweenRestarts = 5000,
SupFlags = {RestartStrategy, MaxRestarts, MaxSecondsBetweenRestarts},
% Building Child specifications
Restart = permanent,
Shutdown = 2000, % Number of seconds the child is allowed to run after receiving shutdown message
Type = worker,
ChildSpec = {'db_server',
{'db_server', start_link, []},
Restart,
Shutdown,
Type,
['db_server']},
% Putting Supervisor and Child(ren) specifications in the return
{ok, {SupFlags, [ChildSpec]}}.
你的超级用户回调模块中的init函数是什么样的? – legoscia
@legoscia,没什么不寻常的,但看看我在问题中的更新 – securecurve