From 47334999d18ccb1c6b687671a4459d22395d4b19 Mon Sep 17 00:00:00 2001 From: Fred Hebert Date: Fri, 28 Feb 2020 22:26:19 -0500 Subject: [PATCH] Fix race condition in rebar_prv_shell boot Fixes https://github.com/erlang/rebar3/issues/2242 Filters out dead processes that can't return process info. --- src/rebar_prv_shell.erl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/rebar_prv_shell.erl b/src/rebar_prv_shell.erl index 07e77992..434302b2 100644 --- a/src/rebar_prv_shell.erl +++ b/src/rebar_prv_shell.erl @@ -222,7 +222,8 @@ rewrite_leaders(OldUser, NewUser) -> %% liveness check. _ = [catch erlang:group_leader(NewUser, Pid) || Pid <- erlang:processes(), - proplists:get_value(group_leader, erlang:process_info(Pid)) == OldUser, + [_|_] = Info <- [erlang:process_info(Pid)], + proplists:get_value(group_leader, Info) == OldUser, is_process_alive(Pid)], %% Application masters have the same problem, but they hold the old group %% leader in their state and hold on to it. Re-point the processes whose