spawn_link(N,M,F,A)

Magnus Fr|berg <>
Thu Dec 10 10:47:17 CET 1998


Shawn Pearce <> wrote:
> Ok, this might be a rather "stupid" question, but here goes:

All questions are good ;-)

> 
> 
> the erl_call hangs with no output, and nothing is logged to either process. 
> Shouldn't i be getting an {'EXIT',{undef,{counter,inc,[<0.43.0>]}} message
> sent to the thread handling the erl_call?  

Yes, you should have got that.
If you run the same shell sequence in an erl shell you will receive just that
(rather your process will terminate unless you trap exit signals).

> Or am i looking at this the wrong way?

No, you have actually found a bug.
In the rpc:reply/5 (which is evaluated due to the erl_call stuff)
we do catch apply(M,F,A) but then F = spawn_link the apply call succeeds and
this function does not trap exit. Thus this process terminates and the
"gen_server:reply(To,{badrpc, {'EXIT', R}});" call is not evaluated =>
erl_call hangs.

The function looks like:
    reply(To,Mod,Fun,Args,Gleader) ->
        set_group_leader(Gleader),
        case catch apply(Mod,Fun,Args) of
            {'EXIT', R} ->
                gen_server:reply(To,{badrpc, {'EXIT', R}});
            Other ->
		gen_server:reply(To,Other)
	 end.

Thanks !

/Magnus




More information about the erlang-questions mailing list