aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErlang/OTP <[email protected]>2018-04-23 10:46:46 +0200
committerErlang/OTP <[email protected]>2018-04-23 10:46:46 +0200
commitf87c6262d4d17a1482c66bfa46acb7c83ee46f78 (patch)
tree7944a3eb0a94db12c45ca79ca5f800fd74574d63
parentba3710484344ed57124574abcd0f19fbe251389c (diff)
parentfceeb3576cc1d6a3cf97a22651119a1b4c96eb48 (diff)
downloadotp-f87c6262d4d17a1482c66bfa46acb7c83ee46f78.tar.gz
otp-f87c6262d4d17a1482c66bfa46acb7c83ee46f78.tar.bz2
otp-f87c6262d4d17a1482c66bfa46acb7c83ee46f78.zip
Merge branch 'hans/ssh/server_exit_normal_exit/OTP-15018' into maint-18
* hans/ssh/server_exit_normal_exit/OTP-15018: ssh: Fix server crashes for exit-normal signals
-rw-r--r--lib/ssh/src/ssh_connection_handler.erl16
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/ssh/src/ssh_connection_handler.erl b/lib/ssh/src/ssh_connection_handler.erl
index 8c73bb8946..1c46e4cd78 100644
--- a/lib/ssh/src/ssh_connection_handler.erl
+++ b/lib/ssh/src/ssh_connection_handler.erl
@@ -1087,8 +1087,20 @@ handle_info({'DOWN', _Ref, process, ChannelPid, _Reason}, Statename, State0) ->
{next_state, Statename, next_packet(State)};
%%% So that terminate will be run when supervisor is shutdown
-handle_info({'EXIT', _Sup, Reason}, _StateName, State) ->
- {stop, {shutdown, Reason}, State};
+handle_info({'EXIT',_Sup,Reason}, StateName, State) ->
+ if
+ State#state.role == client ->
+ %% OTP-8111 tells this function clause fixes a problem in
+ %% clients, but there were no check for that role.
+ {stop, {shutdown,Reason}, State};
+
+ Reason == normal ->
+ %% An exit normal should not cause a server to crash. This has happend...
+ {next_state, StateName, next_packet(State)};
+
+ true ->
+ {stop, {shutdown,Reason}, State}
+ end;
handle_info({check_cache, _ , _},
StateName, #state{connection_state =