You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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}
The text was updated successfully, but these errors were encountered:
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.
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
The text was updated successfully, but these errors were encountered: