Skip to content

Commit

Permalink
Fix crash when $gen_restart message is received for wrong child state
Browse files Browse the repository at this point in the history
ProcessesSupervisor crashes on the $gen_restart message when a pid of
a child is given that is known to the supervisor but not in the
restarting state. This should of course never happen but in the case
it does, it is better to ignore the message than to crash the
supervisor.
  • Loading branch information
arjan authored and derekkraan committed Feb 12, 2024
1 parent cf97e9c commit fbd7620
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions lib/horde/processes_supervisor.ex
Original file line number Diff line number Diff line change
Expand Up @@ -806,9 +806,7 @@ defmodule Horde.ProcessesSupervisor do
%{children: children} = state

case children do
%{^pid => restarting_args} ->
{:restarting, child} = restarting_args

%{^pid => {:restarting, child}} ->
case restart_child(pid, child, state) do
{:ok, state} -> {:noreply, state}
{:shutdown, state} -> {:stop, :shutdown, state}
Expand Down

0 comments on commit fbd7620

Please sign in to comment.