File 0947-sasl-Be-more-resilient-of-exiting-processes.patch of Package erlang

From 2bb7e4844c8a5a76e6f1197137b763dca39764e4 Mon Sep 17 00:00:00 2001
From: Sverker Eriksson <sverker@erlang.org>
Date: Tue, 23 Jun 2020 14:17:21 +0200
Subject: [PATCH] sasl: Be more resilient of exiting processes

when asking about their status.

If Proc dies during sys:get_status(Proc), then treat that the
same as if it died before the call (noproc).

The case of disconnection is unchanged. Not because I'm convinced
it's the correct thing to do, but rather because I'm not convinced
it's wrong.
---
 lib/sasl/src/release_handler_1.erl | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/lib/sasl/src/release_handler_1.erl b/lib/sasl/src/release_handler_1.erl
index de525b292d..ddaa5c7577 100644
--- a/lib/sasl/src/release_handler_1.erl
+++ b/lib/sasl/src/release_handler_1.erl
@@ -659,16 +659,25 @@ get_proc_state(Proc) ->
         {status, _, {module, _}, [_, State, _, _, _]} when State == running ;
                                                            State == suspended ->
             State
-    catch exit:{noproc, {sys, get_status, [Proc]}} ->
+    catch exit:{Reason, {sys, get_status, [Proc]}}
+                when Reason =/= timeout andalso
+                     not (is_tuple(Reason) andalso
+                          element(1,Reason) =:= nodedown) ->
         noproc
     end.
 
 maybe_get_dynamic_mods(Name, Pid) ->
-    case catch gen:call(Pid, self(), get_modules) of
+    try gen:call(Pid, self(), get_modules) of
         {ok, Res} ->
-            Res;
-        Other ->
-            error_logger:error_msg("release_handler: ~p~nerror during a"
+            Res
+    catch
+        exit:Reason when Reason =/= timeout andalso
+                         not (is_tuple(Reason) andalso
+                              element(1,Reason) =:= nodedown) ->
+            [];
+        exit:Other ->
+            error_logger:error_msg("release_handler: {'EXIT',~p}~n"
+                                   "error during a"
                                    " get_modules call to ~p (~w),"
                                    " there may be an error in it's"
                                    " childspec. Exiting ...~n",
-- 
2.26.2

openSUSE Build Service is sponsored by