<div>Hello,</div><div><br></div><div>in my eunit tests I am starting/stopping a gen_server.</div><div><br></div><div>The code used to fail occassionally - gen_server's process name was still registered when gen_server:call(?SERVER, stop) returned and the next gen_server:start_link({local, ?SERVER}...) failed with {error,{already_started,_}}.</div>
<div><br></div><div>Adding unregister to gen_server's terminate/2 solved the problem (terminate/2 is called before responding to the stop request), but is there a reason why gen_server does not unregister its name at the right time?</div>
<div><br></div><div>Thanks, Lukas</div><div><br></div>