aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssh/src
diff options
context:
space:
mode:
authorErlang/OTP <[email protected]>2018-04-19 16:23:03 +0200
committerErlang/OTP <[email protected]>2018-04-19 16:23:03 +0200
commitfc3d146642613c366aa1177f7917abd4c778f58f (patch)
tree73a4cd5b4d1a00f256e3ee94e126c1b677bbbd01 /lib/ssh/src
parent602bd9d348471ef4974d04650c27effb2bf78f1c (diff)
parent94f3ce9d6a649dfab810105036f0ff0e73e3837c (diff)
downloadotp-fc3d146642613c366aa1177f7917abd4c778f58f.tar.gz
otp-fc3d146642613c366aa1177f7917abd4c778f58f.tar.bz2
otp-fc3d146642613c366aa1177f7917abd4c778f58f.zip
Merge branch 'hans/ssh/server_exit_normal_exit_20/OTP-15018' into maint-20
* hans/ssh/server_exit_normal_exit_20/OTP-15018: ssh: Fix server crashes for exit-normal signals
Diffstat (limited to 'lib/ssh/src')
-rw-r--r--lib/ssh/src/ssh_connection_handler.erl17
1 files changed, 15 insertions, 2 deletions
diff --git a/lib/ssh/src/ssh_connection_handler.erl b/lib/ssh/src/ssh_connection_handler.erl
index e11d3adee4..ad23d82ea8 100644
--- a/lib/ssh/src/ssh_connection_handler.erl
+++ b/lib/ssh/src/ssh_connection_handler.erl
@@ -1379,8 +1379,21 @@ handle_event(info, {'DOWN', _Ref, process, ChannelPid, _Reason}, _, D0) ->
{keep_state, D, Repls};
%%% So that terminate will be run when supervisor is shutdown
-handle_event(info, {'EXIT', _Sup, Reason}, _, _) ->
- {stop, {shutdown, Reason}};
+handle_event(info, {'EXIT', _Sup, Reason}, StateName, _) ->
+ Role = role(StateName),
+ if
+ Role == client ->
+ %% OTP-8111 tells this function clause fixes a problem in
+ %% clients, but there were no check for that role.
+ {stop, {shutdown, Reason}};
+
+ Reason == normal ->
+ %% An exit normal should not cause a server to crash. This has happend...
+ keep_state_and_data;
+
+ true ->
+ {stop, {shutdown, Reason}}
+ end;
handle_event(info, check_cache, _, D) ->
{keep_state, cache_check_set_idle_timer(D)};