spawn_link(N,M,F,A)

Magnus Fr|berg magnus@REDACTED
Thu Dec 10 11:34:43 CET 1998


Magnus Fr|berg <magnus@REDACTED> wrote:
> 
> 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. 

Uhum, F is not spawn_link. 'erl_all -e' is equivalent to 
rpc:call(Node, lib, eval_str, [#Bin]) (where the #Bin binary contains your 
input to the erl_call shell).

But the result is almost the same, the rpc:reply process does not trap exit,
but the catch apply(M,F,A) does *not* succeed (the process crashes before
due to an exit signal) and the gen_server:reply is never evaluated.

Thus, if you first evaluates a process_flag(trap_exit, true) you will receive:

napoleon 39> erl_call -e -sname a
process_flag(trap_exit, true),
P=spawn_link(b@REDACTED, erlang,apply,[counter,inc,[list_to_pid("<0.43.0>")]]),
receive 
Any -> {P,Any}
end.
^D
{ok,{<b@REDACTED>,{'EXIT',<b@REDACTED>,{undef,{counter,inc,[<a@REDACTED
on.43.0>]}}}}}
napoleon 40>

/Magnus






More information about the erlang-questions mailing list