Skip to content
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

ssh: start monitor ConnPid before casting socket_control #8310

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jakobsvenningsson
Copy link

We should start monitoring ConnPid before gen_statem:cast(ConnPid, socket_control). It's possible that ConnPid is closed when handling the socket_control cast. If we are unlucky, ConnPid is closed before we start monitoring leading to a noproc being returned from the monitor instead of the actual error.

I had a planned to write a small unit test to test my changes but without meck it will be difficult..

Copy link
Contributor

github-actions bot commented Mar 26, 2024

CT Test Results

    2 files     29 suites   18m 31s ⏱️
  458 tests   453 ✅  5 💤 0 ❌
1 663 runs  1 638 ✅ 25 💤 0 ❌

Results for commit 211ce03.

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

@u3s u3s added the team:PS Assigned to OTP team PS label Mar 26, 2024
@u3s u3s self-assigned this Mar 26, 2024
@jakobsvenningsson
Copy link
Author

I am not sure why one of the tests is failing but it seems unrelated to the changes done in this PR.

@u3s
Copy link
Contributor

u3s commented Mar 28, 2024

I am not sure why one of the tests is failing but it seems unrelated to the changes done in this PR.

Looks like some unrelated environment issue. Happens sometimes on github.

@u3s u3s added the testing currently being tested, tag is used by OTP internal CI label Mar 28, 2024
@IngelaAndin IngelaAndin added the stalled waiting for input by the Erlang/OTP team label Apr 9, 2024
@u3s
Copy link
Contributor

u3s commented Apr 9, 2024

we will stall this one until #8226 is handled

@u3s u3s removed the testing currently being tested, tag is used by OTP internal CI label Apr 11, 2024
@@ -129,12 +129,13 @@ takeover(ConnPid, _, Socket, Options) ->
{_, Callback, _} = ?GET_OPT(transport, Options),
case Callback:controlling_process(Socket, ConnPid) of
ok ->
Ref = erlang:monitor(process, ConnPid),
Copy link
Contributor

Choose a reason for hiding this comment

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

Agree that the code seems to expect a monitor here. I however think it would be more natural to implement this with a gen_statem call and a server side timeout (if a timeout is needed)!

@IngelaAndin
Copy link
Contributor

@Maria-12648430 did you see this one, I am hoping that this one will no longer be necessary ones we get a new solution to
#8226

@Maria-12648430
Copy link
Contributor

Maria-12648430 commented Apr 23, 2024

@Maria-12648430 did you see this one, I am hoping that this one will no longer be necessary ones we get a new solution to #8226

Yes, I saw. Turning this into a call is a bit complicated though, since the statem does a lot of things from this point onward before it replies (like, it changes the callback module a few times). But I'll keep it in mind 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stalled waiting for input by the Erlang/OTP team team:PS Assigned to OTP team PS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants