我有一个genserver模块,我需要作为在后台运行的服务器启动。在开发过程中,我用了一个标准ERL终端启动它Erlang erl_call导致gen_server模块退出
$erl
Erlang R13B01 (erts-5.7.2) [source] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false]
Eshell V5.7.2 (abort with ^G)
1> myserver:start_link().
<ok, some_pid>
一切工作正常,我能够从其他模块调用服务器。
现在,我需要连续运行它作为服务器,并偶然发现erl_call函数。所以现在我做:
erl_call -d -s -a 'myserver start_link' -sname myserver_node
但是,服务器启动,但自动关闭。我启用了-d标志来查看发生了什么问题。这是我在调试跟踪文件中看到的:
===== Log started ======
Fri Oct 2 04:42:32 2009
erl_call: sh -c exec erl -noinput -sname myserver_node -s erl_reply reply 174.143.175.70 42457 5882
=ERROR REPORT==== 2-Oct-2009::04:44:05 ===
** Generic server myserver terminating
** Last message in was {'EXIT',<0.59.0>,normal}
** When Server state == {20499,24596,28693,32790,36887,40984,45081}
** Reason for termination ==
** {function_clause,[{myserver,terminate,
[normal,
{20499,24596,28693,32790,36887,40984,45081}]},
{gen_server,terminate,6},
{proc_lib,init_p_do_apply,3}]}
任何想法是什么导致服务器自动关闭?跟踪甚至说终止的原因是正常的。但我没有发起终止。