Consider this simple GenServer module:
defmodule Crap do
use GenServer
...
def handle_info(:kill_me_pls, state) do
GenServer.stop(self)
{:noreply, state}
end
def terminate(_, state) do
IO.inspect "Look! I'm dead."
end
end
And consider adding these expressions to repl:
{:ok, pid} = Crap.start_link
send_message_to_that_pid
And this is where my thoughts start from, because it Process.alive? pidreturns true, but the process does not respond, and is terminatenot called, although if I call GenServer.stop(pid), the call in repl on the βcleanβ process (which does not receive the message about the kill) kills it properly. If the stop caused the process that received: the kill_me_pls message hung a replica.
Haito source
share