Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERL-163: Spurious error report on node exit with TLS distribution #3113

Closed
OTP-Maintainer opened this issue Jun 13, 2016 · 4 comments
Closed
Labels
bug Issue is reported as a bug priority:medium
Milestone

Comments

@OTP-Maintainer
Copy link

Original reporter: legoscia
Affected version: OTP-19.0
Fixed in version: OTP-19.2
Component: Not Specified
Migrated from: https://bugs.erlang.org/browse/ERL-163


When an Erlang node that has an active distribution connection using TLS exits, it prints the following error message:

{noformat}
2016-06-13 15:21:28 supervisor_report   
    supervisor: {local,ssl_connection_sup_dist}
    errorContext: shutdown_error
    reason: {shutdown,normal}
    offender: [{nb_children,1},{id,undefined},{mfargs,{tls_connection,start_link,[]}},{restart_type,temporary},{shutdown,4000},{child_type,worker}]
{noformat}

To reproduce, start two nodes configured for TLS distribution, and in one of them, type:

{noformat}
net_adm:ping(foo@localhost).
q().
{noformat}

I dug into this, and found two possible changes that make this error message go away. The first one makes the supervisor module ignore exit reasons of the form {{❴shutdown, _❵}} just like it ignores the exit reason {{shutdown}}, when terminating {{simple_one_for_one}} children:

{code:diff}
diff --git a/lib/stdlib/src/supervisor.erl b/lib/stdlib/src/supervisor.erl
index a594c66..1b33803 100644
--- a/lib/stdlib/src/supervisor.erl
+++ b/lib/stdlib/src/supervisor.erl
@@ -1081,6 +1081,9 @@ wait_dynamic_children(#child{restart_type=RType} = Child, Pids, Sz,
         {'DOWN', _MRef, process, Pid, shutdown} ->
             wait_dynamic_children(Child, ?SETS:del_element(Pid, Pids), Sz-1,
                                   TRef, EStack);
+        {'DOWN', _MRef, process, Pid, {shutdown, _}} ->
+            wait_dynamic_children(Child, ?SETS:del_element(Pid, Pids), Sz-1,
+                                  TRef, EStack);
 
         {'DOWN', _MRef, process, Pid, normal} when RType =/= permanent ->
             wait_dynamic_children(Child, ?SETS:del_element(Pid, Pids), Sz-1,

{code}

I couldn't find this spelled out in the documentation anywhere, but I seem to remember that a shutdown exit reason in a tuple is supposed to be equivalent to the plain atom.

The other possible fix is to make {{ssl_connection}} exit with just {{shutdown}}:

{code:diff}
diff --git a/lib/ssl/src/ssl_connection.erl b/lib/ssl/src/ssl_connection.erl
index 90e0810..16edefd 100644
--- a/lib/ssl/src/ssl_connection.erl
+++ b/lib/ssl/src/ssl_connection.erl
@@ -848,7 +848,7 @@ handle_call({close, _} = Close, From, StateName, State, Connection) ->
     %% Run terminate before returning so that the reuseaddr
     %% inet-option 
     Result = Connection:terminate(Close, StateName, State),
-    {stop_and_reply, {shutdown, normal},  
+    {stop_and_reply, shutdown,  
      {reply, From, Result}, State};
 handle_call({shutdown, How0}, From, _,
            #state{transport_cb = Transport,

{code}
@OTP-Maintainer
Copy link
Author

ingela said:

I think this is a supervisor bug, {shutdown, Reason} should be handled the same a shutdown.
The function wait_dynamic_children should behave as do_restart.

@OTP-Maintainer
Copy link
Author

ingela said:

I think this is MW issue.

@OTP-Maintainer
Copy link
Author

legoscia said:

I submitted a pull request with the former fix: https://github.com/erlang/otp/pull/1158

@OTP-Maintainer
Copy link
Author

siri said:

This is fixed by PR-1158

@OTP-Maintainer OTP-Maintainer added bug Issue is reported as a bug priority:medium labels Feb 10, 2021
@OTP-Maintainer OTP-Maintainer added this to the OTP-19.2 milestone Feb 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is reported as a bug priority:medium
Projects
None yet
Development

No branches or pull requests

1 participant