请教一个gen_supervisor启动不成功的问题

2 views
Skip to first unread message

crackcell

unread,
Oct 6, 2009, 3:02:41 AM10/6/09
to Erlang China
情况如下:
写了一个gen_supervisor的模块,下面挂了一个gen_server的模块,用在shell里面启动super,报错:
exception exit: shutdown。
按照我的理解应该是gen_server模块自己在启动的时候挂掉了。因为我在gen_server的模块的init中,写process_flag
(trap_exit, true),在shell里面启动,它启动起来,马上又退出了。

查了几天了都没有结果,是在没办法才斗胆在这里发帖问。

crackcell

unread,
Oct 6, 2009, 3:11:27 AM10/6/09
to Erlang China
用的是one_for_one
应该是这个代码出错的:
Java代码

1. {ok, {{one_for_one, 1000, 3600},
2. [{kerlmq_config,
3. {kerlmq_config, start_link, "test/kerlmq.conf"},
4. permanent,
5. 10000,
6. worker,
7. [kerlmq_config]}
8. ]}}.

{ok, {{one_for_one, 1000, 3600},
[{kerlmq_config,
{kerlmq_config, start_link, "test/kerlmq.conf"},
permanent,
10000,
worker,
[kerlmq_config]}
]}}.

这是rb看的日志:

Java代码

1. 4> rb:show(7).
2.
3. SUPERVISOR REPORT <0.45.0>
2009-10-06 15:07:16
4.
===============================================================================
5. Reporting supervisor
{global,kerlmq_super}
6.
7. Child
process
8.
errorContext
start_error
9. reason
10. {'EXIT',{undef,[{kerlmq_config,start_link,"test/
kerlmq.conf"},
11. {supervisor,do_start_child,2},
12. {supervisor,start_children,3},
13. {supervisor,init_children,2},
14. {gen_server,init_it,6},
15. {proc_lib,init_p_do_apply,3}]}}
16.
pid
undefined
17.
name
kerlmq_config
18. start_function
{kerlmq_config,start_link,"test/kerlmq.conf"}
19.
restart_type
permanent
20.
shutdown
10000
21.
child_type
worker
22.
23. ok

crackcell

unread,
Oct 6, 2009, 3:42:36 AM10/6/09
to Erlang China
问题自己解决了......
"test/kerlmq.conf"这个地方要加上[]
汗,开始死活搞不懂那个undef是为什么............


On Oct 6, 3:02 pm, crackcell <tanmengl...@gmail.com> wrote:

Zoom.Quiet

unread,
Oct 6, 2009, 6:09:21 AM10/6/09
to erlang...@googlegroups.com
2009/10/6 crackcell <tanme...@gmail.com>:

> 问题自己解决了......
> "test/kerlmq.conf"这个地方要加上[]
> 汗,开始死活搞不懂那个undef是为什么............
>

呃....

>
> On Oct 6, 3:02 pm, crackcell <tanmengl...@gmail.com> wrote:
>> 情况如下:
>> 写了一个gen_supervisor的模块,下面挂了一个gen_server的模块,用在shell里面启动super,报错:
>> exception exit: shutdown。
>> 按照我的理解应该是gen_server模块自己在启动的时候挂掉了。因为我在gen_server的模块的init中,写process_flag
>> (trap_exit, true),在shell里面启动,它启动起来,马上又退出了。
>>
>> 查了几天了都没有结果,是在没办法才斗胆在这里发帖问。

--
http://zoomquiet.org 人生苦短? Pythonic!
usage 7-zip to replace WinRAR/WinZip; You can get the truely Freedom 4 software.

Reply all
Reply to author
Forward
0 new messages