link to hibernated process

Dinislam Salikhov Dinislam.Salikhov@REDACTED
Sun Apr 26 18:26:55 CEST 2020


Hello,

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:

Erlang/OTP 21 [erts-10.3.5.9] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [hipe]

Eshell V10.3.5.9  (abort with ^G)
1> F = fun() -> {links,L} = process_info(self(), links), L end.
#Fun<erl_eval.20.128620087>
2> C = fun() -> io:format("child: ~p ~p~n", [self(),F()]), erlang:hibernate(erlang,exit,[ok]) end.
#Fun<erl_eval.20.128620087>
3> spawn(fun() -> spawn_link(C), io:format("parent: ~p ~p~n", [self(), F()]) end).
parent: <0.82.0> [<0.83.0>]
child: <0.83.0> [<0.82.0>]
<0.82.0>
4> process_info(pid(0,82,0),links).  % dead parent, as expected
undefined
5> process_info(pid(0,83,0),links).  % alive child, unexpected
{links,[]}

Is it a bug? Or do I miss anything?

Dinislam Salikhov


More information about the erlang-questions mailing list