<html><head><meta http-equiv="Content-Type" content="text/html charset=gb2312"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Explicitly call erlang:exit(error) will make this example works as expected: both 4> and 5> returns undefined.</div><div class=""><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">3> spawn(fun() -> spawn_link(C), io:format("parent: ~p ~p~n", [self(), F()]), erlang:exit(error) end).</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><br class=""></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">Cheers,</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">Yao</span></div></div></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><br class=""></span></div><div style=""><blockquote type="cite" class=""><div class="">在 2020年4月27日,00:26,Dinislam Salikhov <<a href="mailto:Dinislam.Salikhov@kaspersky.com" class="">Dinislam.Salikhov@kaspersky.com</a>> 写道:</div><br class="Apple-interchange-newline"><div class=""><div class="">Hello,<br class=""><br class="">There is a link from a process to another process which may come into hibernate state. I expect that when the former process terminates, the latter one does as well, but it doesn't happen:<br class=""><br class="">Erlang/OTP 21 [erts-10.3.5.9] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [hipe]<br class=""><br class="">Eshell V10.3.5.9  (abort with ^G)<br class="">1> F = fun() -> {links,L} = process_info(self(), links), L end.<br class="">#Fun<erl_eval.20.128620087><br class="">2> C = fun() -> io:format("child: ~p ~p~n", [self(),F()]), erlang:hibernate(erlang,exit,[ok]) end.<br class="">#Fun<erl_eval.20.128620087><br class="">3> spawn(fun() -> spawn_link(C), io:format("parent: ~p ~p~n", [self(), F()]) end).<br class="">parent: <0.82.0> [<0.83.0>]<br class="">child: <0.83.0> [<0.82.0>]<br class=""><0.82.0><br class="">4> process_info(pid(0,82,0),links).  % dead parent, as expected<br class="">undefined<br class="">5> process_info(pid(0,83,0),links).  % alive child, unexpected<br class="">{links,[]}<br class=""><br class="">Is it a bug? Or do I miss anything?<br class=""><br class="">Dinislam Salikhov<br class=""></div></div></blockquote></div><br class=""></body></html>