tonini / alchemist.el

Elixir Tooling Integration Into Emacs
http://www.alchemist-elixir.org
906 stars 103 forks source link

Raising errors in linked processes to Alchemist-IEx cause it to hang #263

Open jclosure opened 7 years ago

jclosure commented 7 years ago

Linking a process Alchemist-IEx that happens to blow up, causes the repl to hang.

Example:

Expected Behavior:

Here's a snipped from IEx running in a console, where the expected behavior is manifest.

iex(2)> self
#PID<0.1754.0>
iex(3)> spawn_link fn -> raise "oops" end
** (EXIT from #PID<0.1754.0>) an exception was raised:
    ** (RuntimeError) oops
        :erlang.apply/2

Interactive Elixir (1.3.4) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)>
17:01:04.555 [error] Process #PID<0.1758.0> raised an exception
** (RuntimeError) oops
    :erlang.apply/2

nil
iex(2)> self
#PID<0.1759.0>

Actual Behavior in Alchemist-IEx:

iex(2)> self
#PID<0.1766.0>
iex(3)> spawn_link fn -> raise "oops" end

> 03:26:50.881 [error] Process #PID<0.92.0> raised an exception
> *\* (RuntimeError) oops
>     :erlang.apply/2
> *\* (EXIT from #PID<0.87.0>) an exception was raised:
>     *\* (RuntimeError) oops
>         :erlang.apply/2

At this point the Alchemist-IEx buffer is hung and not recoverable. Since IEx itself can recover by spawning a new process for the REPL, this kind of exception in a linked process should not kill Alchemist-IEx.