[erlang-questions] Erlang init_per_group terminates gen_server beforehand

Fred Hebert mononcqc@REDACTED
Mon Apr 18 15:38:36 CEST 2016


On 04/18, Galina Lezina wrote:
>Common test init_per_group/2 terminates gen_server beforehand (right in the
>end of init_per_group/2 call) when it is started with gen_server:start_link.
>But it is ok to start server with gen_server:start.
>
>gen_server can be started with any of these methods (start and start_link)
>in init_per_suite/1 and init_per_testcase/2 and it will work fine.
>
>Why it is not possible to start gen_server in init_per_group/2 with
>gen_server:start_link?

The distinction is that the running of group initialization and shutdown 
appears to take place in a short-lived transient process.

Because of that, anything that is linked to the process running 
init_per_group will die when the initialization phase for the group is 
done.

I do not know why this is, but this has been a stable implementation 
detail for years now.

Regards,
Fred.



More information about the erlang-questions mailing list