Killing GenServer from inside
<p>Consider such simple GenServer module:</p>

<pre><code>defmodule Crap do
  use GenServer

  ... #All the needed crap

  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
</code></pre>

<p>And consider putting these expressions into the repl:</p>

<pre><code>{:ok, pid} = Crap.start_link

send_message_to_that_pid
</code></pre>

<p>And this is where my conceirns start because <code>Process.alive? pid</code> returns true, but process is not responsive and <code>terminate</code> isn't being called, although if I call <code>GenServer.stop(pid)</code> called in repl on 'clean' process (that had not receive kill message) kills it properly. If stop called on process that received :kill_me_pls message hungs up the repl.</p>