[erlang-bugs] Twisty turny gen_server hang

Matthew Dempsky matthew@REDACTED
Fri Jul 27 20:54:05 CEST 2007


I have a module:

    -module(bloop).
    -compile(export_all).

    start_one() ->
        gen_server:start({local, one}, ?MODULE, one, []).
    start_link_two() ->
        gen_server:start_link({local, two}, ?MODULE, two, []).

    init(one) ->
        start_link_two();
    init(two) ->
        throw(burlap).

When I run ``bloop:start_one()'' from the command-line, it just hangs:

    $ erl
    Erlang (BEAM) emulator version 5.5.5 [source] [async-threads:0]
[kernel-poll:false]

    Eshell V5.5.5  (abort with ^G)
    1> bloop:start_one().

    (^-- hanging)

Instead I expect it to evaluate to ``{error,{bad_return_value,burlap}}''.

My reasoning: ``bloop:start_link_two()'' causes the calling process to
exit with ``{bad_return_value,burlap}'', and if I change ``init(one)''
to just ``exit({bad_return_value,burlap})'', that is the return value
for ``bloop:start_one()''.



More information about the erlang-bugs mailing list