Skip to content

Fix channel close procedure when the peer dies or our handler goes down #9103

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

Merged
merged 5 commits into from
May 26, 2025

Conversation

yarisx
Copy link
Contributor

@yarisx yarisx commented Nov 22, 2024

Fix proposal for the issue #9102

Copy link
Contributor

github-actions bot commented Nov 22, 2024

CT Test Results

    2 files     29 suites   20m 14s ⏱️
  470 tests   465 ✅  4 💤 1 ❌
1 675 runs  1 650 ✅ 24 💤 1 ❌

For more details on these failures, see this check.

Results for commit 7eca95a.

♻️ 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

@IngelaAndin IngelaAndin added the team:PS Assigned to OTP team PS label Nov 25, 2024
@u3s u3s self-assigned this Nov 26, 2024
@u3s u3s added the testing currently being tested, tag is used by OTP internal CI label Nov 27, 2024
@yarisx yarisx marked this pull request as draft November 29, 2024 15:50
@yarisx
Copy link
Contributor Author

yarisx commented Nov 29, 2024

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.

@u3s u3s removed the testing currently being tested, tag is used by OTP internal CI label Dec 2, 2024
@yarisx yarisx marked this pull request as ready for review December 3, 2024 11:43
@u3s u3s added the waiting waiting for changes/input from author label Jan 8, 2025
@yarisx
Copy link
Contributor Author

yarisx commented Jan 13, 2025

What is expected from me? I don't see any comments, have I missed something?

@u3s
Copy link
Contributor

u3s commented Jan 13, 2025

You wrote:

I have an update to fix that but need some time to make a test.

I thought you want to add some testcase code ...

@yarisx
Copy link
Contributor Author

yarisx commented Jan 13, 2025

The test is updated by the latest commit.

@u3s u3s removed the waiting waiting for changes/input from author label Jan 13, 2025
@u3s u3s added the waiting waiting for changes/input from author label Feb 10, 2025
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.
@yarisx yarisx force-pushed the ymaslenn/ssh_channel_close_proper branch from 557de4f to 704973a Compare February 18, 2025 10:18
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).
@yarisx yarisx force-pushed the ymaslenn/ssh_channel_close_proper branch from 704973a to ca10880 Compare February 18, 2025 10:49
@IngelaAndin IngelaAndin removed the waiting waiting for changes/input from author label Feb 18, 2025
@u3s u3s linked an issue Apr 1, 2025 that may be closed by this pull request
@u3s u3s added the testing currently being tested, tag is used by OTP internal CI label Apr 1, 2025
Copy link
Contributor

@u3s u3s left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this PR and digging into this problem!
Please check comments inline.

Comment on lines 2024 to 2025
ct:log("~p:~p open incomplete channel done - should not have happened",[?MODULE,?LINE]),
Parent ! {self(), {fail, "Unexpected channel success"}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are those 2 lines a dead code? if so, maybe replace them with code comment?

@u3s u3s added the waiting waiting for changes/input from author label Apr 8, 2025
@u3s u3s added testing currently being tested, tag is used by OTP internal CI and removed testing currently being tested, tag is used by OTP internal CI waiting waiting for changes/input from author labels Apr 22, 2025
@IngelaAndin IngelaAndin added this to the OTP-28.1 milestone Apr 29, 2025
@u3s u3s merged commit 6fe4430 into erlang:maint May 26, 2025
22 of 24 checks passed
@u3s
Copy link
Contributor

u3s commented May 27, 2025

PR is merged to maint, master branches.
Will be part of upcoming emergency patches for Erlang/OTP.

Thanks for contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team:PS Assigned to OTP team PS testing currently being tested, tag is used by OTP internal CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SSH: incorrect channel cache update when closing the channel client-side
3 participants