[erlang-bugs] Fwd: exit(self(), normal) causes calling process to exit

Stavros Aronis <>
Wed Nov 28 17:50:24 CET 2012


After some speculation on
stackoverflow<http://stackoverflow.com/questions/13459190/erlang-exit-2-function>
I
think I will report this here as well. (I am directly copying the content
of the question.)

I am playing around with the
exit/2<http://erlang.org/doc/man/erlang.html#exit-2>function and its
behavior when self() is used as a Pid and normal as a
Reason.

Erlang R15B03 (erts-5.9.3) [source] [64-bit] [smp:8:8] [async-threads:0]
[hipe] [kernel-poll:false]

Eshell V5.9.3  (abort with ^G)
1> self().
<0.32.0>
2> exit(self(), normal).
** exception exit: normal
3> self().
<0.35.0>

Shouldn't it be the case that only a 'normal' exit message is sent to the
shell process, so there is no reason to exit?

Similarly:

4> spawn(fun() -> receive Pid -> Pid ! ok end end).
<0.38.0>
5> exit(v(4), normal).
true
6> v(4) ! self().
<0.35.0>
7> flush().
Shell got ok
ok

But:

8> spawn(fun() -> exit(self(), normal), receive _ -> ok end end).
<0.43.0>
9> is_process_alive(v(8)).
false
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20121128/a6aa1108/attachment.html>


More information about the erlang-bugs mailing list