File 6451-supervisor-Add-missing-shutdown-clauses.patch of Package erlang
From b0713611f2a331891da75597153cc5d093a18efa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= <lhoguin@vmware.com>
Date: Wed, 3 Nov 2021 10:54:18 +0100
Subject: [PATCH] supervisor: Add missing shutdown clauses
This prevents annoying shutdown_error logs from being printed
in cases both the process and its supervisor started shutting
down at the same time.
---
lib/stdlib/src/supervisor.erl | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/lib/stdlib/src/supervisor.erl b/lib/stdlib/src/supervisor.erl
index eea5b6a513..17e714fcc0 100644
--- a/lib/stdlib/src/supervisor.erl
+++ b/lib/stdlib/src/supervisor.erl
@@ -926,6 +926,8 @@ shutdown(#child{pid=Pid, shutdown=brutal_kill} = Child) ->
case unlink_flush(Pid, Reason0) of
killed ->
ok;
+ shutdown when not (?is_permanent(Child)) ->
+ ok;
{shutdown, _} when not (?is_permanent(Child)) ->
ok;
normal when not (?is_permanent(Child)) ->
@@ -1039,6 +1041,10 @@ wait_dynamic_children(#child{shutdown=brutal_kill} = Child, Pids, Sz,
wait_dynamic_children(Child, maps:remove({Pid, Mon}, Pids),
Sz-1, TRef, EStack);
+ shutdown when not (?is_permanent(Child)) ->
+ wait_dynamic_children(Child, maps:remove({Pid, Mon}, Pids),
+ Sz-1, TRef, EStack);
+
{shutdown, _} when not (?is_permanent(Child)) ->
wait_dynamic_children(Child, maps:remove({Pid, Mon}, Pids),
Sz-1, TRef, EStack);
--
2.31.1