[erlang-questions] simple_one_for_one child not restarting

27 views
Skip to first unread message

Jacob Vorreuter

unread,
Dec 22, 2010, 7:08:05 PM12/22/10
to erlang-q...@erlang.org
I'm having a problem where a child of a simple_one_for_one supervisor exists unexpectedly and is not replaced/restarted.

In my test, I'm sending an exit signal to the child process, but supervisor:which_children still shows the process as being supervised.

1> test_sup:start_link().
{ok,<0.33.0>}
2> {ok, Pid} = test_sup:start_child().
{ok,<0.35.0>}
3> supervisor:which_children(test_sup).
[{undefined,<0.35.0>,worker,[test]}]
4> exit(Pid, die).
true
5> is_process_alive(Pid).
false
6> supervisor:which_children(test_sup).
[{undefined,<0.35.0>,worker,[test]}]
7> 'WTF?!?'.
'WTF?!?'.

test.erl https://gist.github.com/752329
test_sup.erl: https://gist.github.com/752330

Am I doing it wrong?

Thanks,

Jake
________________________________________________________________
erlang-questions (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-questio...@erlang.org

Tomasz Maciejewski

unread,
Dec 22, 2010, 7:17:37 PM12/22/10
to erlang-q...@erlang.org
Dnia 23-12-2010 o 01:08:05 Jacob Vorreuter <jacob.v...@gmail.com> napisał(a):

> Am I doing it wrong?


You don't link the worker process to the supervisor.

test:erl:

6 start_link() ->
7 gen_server:start(?MODULE, [], []).


Use gen_server:start_link() instead.

--
Tomasz Maciejewski

Jacob Vorreuter

unread,
Dec 22, 2010, 7:24:57 PM12/22/10
to Tomasz Maciejewski, erlang-q...@erlang.org
*facepalm*

Thank you

Reply all
Reply to author
Forward
0 new messages