diff options
author | Erlang/OTP <[email protected]> | 2018-05-08 12:10:37 +0200 |
---|---|---|
committer | Erlang/OTP <[email protected]> | 2018-05-08 12:10:37 +0200 |
commit | e42ad012d6aa657425ee6a9117c03607f359269b (patch) | |
tree | fbd39ff04ab3858cccc4e7ec8caf8bcb11fc0bfb | |
parent | 90edf69ba7acbfaa55a709fa115ce8bb782b9dc9 (diff) | |
parent | bea68371f7acc28958347cc0c11d52e0f3744d69 (diff) | |
download | otp-e42ad012d6aa657425ee6a9117c03607f359269b.tar.gz otp-e42ad012d6aa657425ee6a9117c03607f359269b.tar.bz2 otp-e42ad012d6aa657425ee6a9117c03607f359269b.zip |
Merge branch 'hans/ssh/server_exit_normal_exit_19/OTP-15018' into maint-19
* hans/ssh/server_exit_normal_exit_19/OTP-15018:
ssh: Fix server crashes for exit-normal signals
-rw-r--r-- | lib/ssh/src/ssh_connection_handler.erl | 17 |
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 fc75945a5b..60008b6301 100644 --- a/lib/ssh/src/ssh_connection_handler.erl +++ b/lib/ssh/src/ssh_connection_handler.erl @@ -1280,8 +1280,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)}; |