-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Fix channel close procedure when the peer dies or our handler goes down #9103
base: maint
Are you sure you want to change the base?
Conversation
CT Test Results 2 files 29 suites 20m 11s ⏱️ Results for commit ca10880. ♻️ This comment has been updated with latest results. To speed up review, make sure that you have read Contributing to Erlang/OTP and that all checks pass. See the TESTING and DEVELOPMENT HowTo guides for details about how to run test locally. Artifacts// Erlang/OTP Github Action Bot |
There is possibility to get a crash if the channel handler goes down before receiving 'channel-open-confirmation' from the peer. I have an update to fix that but need some time to make a test. |
What is expected from me? I don't see any comments, have I missed something? |
You wrote:
I thought you want to add some testcase code ... |
The test is updated by the latest commit. |
%% Here we first collect the list of channel id's handled by the process | ||
%% Do NOT remove them from the cache - they are not closed yet! | ||
Channels = ssh_client_channel:cache_foldl( | ||
fun(#channel{user=U} = Channel, Acc) when U == ChannelPid -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
previously this fun deleted the channel cache. now we are just sending channel close to peer.
I assume if peer responds with channel close we will delete entry from cache.
what if the peer does not reply? idle_time
timeout will not handle that AFAIK.
what do you think about it? shouldn't they be removed after some timeout?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right. Also the same can happen if our side requested channel to be closed but the peer failed to respond. I've prepared an update to handle such cases, will push after a bit of cleaning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the code and some test, rebased to the latest 'maint'
Account for the case when user channel handler goes down before the channel opening procedure is completed: if channel open confirmation is received for such channel - the channel is automatically closed. Add a test for such scenario.
557de4f
to
704973a
Compare
If the peer fails to respond to ssh_msg_channel_close the corresponding channel entry will be removed from cache after the timeout (assuming the connection is still alive with probably other channels open).
704973a
to
ca10880
Compare
Fix proposal for the issue #9102