<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
</head>
<body class='hmmessage'><div dir='ltr'>
Hello,<br>I think something is wrong here.<br>> Bob die of noconnection.<br><br>This is printed by <br>> {'EXIT', Bob, Reason} -><br>> io:format ("Bob died of ~p.~n", [Reason] ),<br><br>So alice is in fact receiving bob last death cry :D and process_flag translate it in a message instead of transmitting exit signal to alice; I think this is ok from the point of view of Alice, so the real problem is that bob is dying (I know it's mundane, but I learned not to make assumption).<br>Mmm, well I don't know if having no more a connection between the process makes Erlang VM do some assumption of a virtual master node.<br>Well, if you want my opinion, I think that you should file a bug on the Erlang bugs mailing list if no one comes up with a proper explanation.<br>Even if what we're thinking is wrong and this is not a bug, in the past I had a problem on node lookup and they resolved it.<br>These are my two cents, but if you can please let me know if there are further updates 'cause it's a really interesting problem.<br><br>BTW, before filing a bug, could you please substitute spawn_link with spawn_monitor and remove the process_flag lines? It would be interesting to understand if either bob dies on its own or it's killed by no more being able to communicate with alice.<br><br>Vincenzo<br><br><div>> Date: Wed, 17 Aug 2011 10:57:35 -0600<br>> From: erlang@nimqas.com<br>> To: maggio.vincenzo@hotmail.it<br>> CC: erlang-questions@erlang.org<br>> Subject: RE: [erlang-questions] Process surviving disconnect<br>> <br>> Thank you very much Vincenzo. You affirmed my assertion that Bob should <br>> survive the disconnect.<br>> Nevertheless he dies.<br>> I will point out exactly what I do and maybe someone can spot the error <br>> in my code, my setup or my thinking and tell me what I am doing wrong.<br>> <br>> I start a node on gca.local:<br>> unroot@gca:~$ erl -name 'bob@gca.local' -setcookie 123<br>> <br>> I start a node on usa.local:<br>> unroot@usa:~$ erl -name 'alice@usa.local' -setcookie 123<br>> <br>> I start sasl on bob@gca.local:<br>> (bob@gca.local)1> application:start (sasl).<br>> <br>> I run alice:start/0 on alice@usa.local:<br>> (alice@usa.local)1> alice:start ().<br>> true<br>> <br>> I look for bob on bob@gca.local and save its pid:<br>> (bob@gca.local)2> whereis (bob).<br>> <0.65.0><br>> (bob@gca.local)3> Pid = whereis (bob).<br>> <0.65.0><br>> <br>> I cut the network cable and wait a minute for the timeout.<br>> <br>> On alice@usa.local I get the following output:<br>> =ERROR REPORT==== 17-Aug-2011::10:53:21 ===<br>> ** Node 'bob@gca.local' not responding **<br>> ** Removing (timedout) connection **<br>> Bob die of noconnection.<br>> <br>> Nice, Alice trapped Bob's death and reported it. I check for Alice:<br>> (alice@usa.local)2> whereis (alice).<br>> <0.42.0><br>> <br>> Alice is up and running.<br>> <br>> On bob@usa.local I get the following output:<br>> =ERROR REPORT==== 17-Aug-2011::10:53:10 ===<br>> ** Node 'alice@usa.local' not responding **<br>> ** Removing (timedout) connection **<br>> <br>> But Bob is dead:<br>> (bob@gca.local)4> whereis (bob).<br>> undefined<br>> (bob@gca.local)5> is_process_alive (Pid).<br>> false<br>> <br>> I really do not understand what is happening.<br>> <br>> <br>> Thank you in advance<br>> <br>> Anchise<br>> <br>> Here goes the code I used:<br>> <br>> -module (alice).<br>> -compile (export_all).<br>> <br>> start () -> register (alice, spawn (fun init/0) ).<br>> <br>> stop () -> whereis (alice) ! stop.<br>> <br>> init () -><br>> process_flag (trap_exit, true),<br>> Bob = spawn_link ('bob@gca.local', bob, start, [self () ] ),<br>> loop (Bob).<br>> <br>> loop (Bob) -><br>> receive<br>> stop -> ok;<br>> {'EXIT', Bob, Reason} -><br>> io:format ("Bob died of ~p.~n", [Reason] ),<br>> loop (Bob);<br>> Msg -><br>> io:format ("Alice received ~p.~n", [Msg] ),<br>> loop (Bob)<br>> end.<br>> <br>> <br>> -module (bob).<br>> -compile (export_all).<br>> <br>> start (Alice) -><br>> process_flag (trap_exit, true),<br>> register (bob, self () ),<br>> loop (Alice).<br>> <br>> loop (Alice) -><br>> receive<br>> stop -> ok;<br>> {'EXIT', Alice, Reason} -><br>> io:format ("Alice died of ~p.~n", [Reason] ),<br>> loop (Alice);<br>> Msg -><br>> io:format ("Bob received ~p.~n", [Msg] ),<br>> loop (Alice)<br>> end.<br>> <br>> <br>> On Wed, 17 Aug 2011 12:47:02 +0200, Vincenzo Maggio wrote:<br>> > Hello,<br>> > without further info a debug is rather difficult.<br>> > But let's try to at least start analysis of the problem:<br>> ><br>> >> - Has this something to do that I initially spawn Bob from the <br>> >> Alice<br>> >> node?<br>> ><br>> > Absolutely not: this would hit the very foundation of Erlang, process<br>> > referential transparency. When a process is started is a brand new,<br>> > clean entity (indeed, default process heap space is always the same<br>> > size!).<br>> ><br>> >> - How can I make Bob to survive a connection loss?<br>> ><br>> > Look above: it SHOULD survive.<br>> ><br>> > Can you please start SASL (application:start(sasl) from the shell)<br>> > and see if shell log puts some further information?<br>> ><br>> > Vincenzo<br>> <br></div> </div></body>
</html>