File 6661-Do-not-emit-unexpected-message-on-shutdown.patch of Package erlang
From df0ef03fee5b797c48f009774bf42747f817baf7 Mon Sep 17 00:00:00 2001
From: Maxim Fedorov <maximfca@gmail.com>
Date: Mon, 6 Feb 2023 21:15:29 -0800
Subject: [PATCH] Do not emit "unexpected" message on shutdown
During shutdown, net_kernel process that is linked to an
acceptor, gracefully terminates, triggering
`{EXIT, net_kernel, shutdown}` message sent to the acceptor.
However acceptor does not expect it, and instead of a graceful
shutdown logs a confusing warning.
---
lib/ssl/src/inet_tls_dist.erl | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/lib/ssl/src/inet_tls_dist.erl b/lib/ssl/src/inet_tls_dist.erl
index f0b5da43b3..5951ba9e63 100644
--- a/lib/ssl/src/inet_tls_dist.erl
+++ b/lib/ssl/src/inet_tls_dist.erl
@@ -232,7 +232,7 @@ gen_accept(Driver, Listen) ->
%% smaller than MaxPending
accept_loop(DLK, undefined, MaxPending, Pending) when map_size(Pending) < MaxPending ->
accept_loop(DLK, spawn_accept(DLK), MaxPending, Pending);
-accept_loop(DLK, HandshakePid, MaxPending, Pending) ->
+accept_loop({_, _, NetKernelPid} = DLK, HandshakePid, MaxPending, Pending) ->
receive
{continue, HandshakePid} when is_pid(HandshakePid) ->
accept_loop(DLK, undefined, MaxPending, Pending#{HandshakePid => true});
@@ -244,6 +244,9 @@ accept_loop(DLK, HandshakePid, MaxPending, Pending) ->
%% HandshakePid crashed before turning into Pending, which means
%% error happened in accept. Need to restart the listener.
exit(Reason);
+ {'EXIT', NetKernelPid, Reason} ->
+ %% Since we're trapping exits, need to manually propagate this signal
+ exit(Reason);
Unexpected ->
?LOG_WARNING("TLS distribution: unexpected message: ~p~n" ,[Unexpected]),
accept_loop(DLK, HandshakePid, MaxPending, Pending)
--
2.35.3