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

ssm start-session messes up the terminal after timeout on WSL #62

Open
bencehornak-gls opened this issue Feb 21, 2023 · 5 comments
Open

Comments

@bencehornak-gls
Copy link

Describe the bug

Note: this issue was originally opened here: aws/aws-cli#7574, but I was advised to re-open it here.

On WSL the aws ssm start-session command corrupts my terminal after it terminates due to inactivity. Regardless of what key I press, no characters appear in the terminal any more. I have tried Ctrl + C too, but it doesn't change the unresponsiveness of my terminal either.

Expected Behavior

I should be able to use the terminal for other commands.

Current Behavior

Regardless of what key I press, nothing appears in the terminal. The consequence of this is that I have to close the terminal and open a new one after more-or-less every connection, which is uncomfortable, considering that my history is gone, I have to go back to the same directory and have to initialize my AWS context again.

Reproduction Steps

  1. Install Ubuntu 2020 using WSL 2 on a Windows Enterprise machine.
  2. Install AWS CLI and the SSM plugin
  3. Launch a session with aws ssm start-session --target i-XXXXXXXXXXX
  4. Wait 5 minutes
  5. Now the terminal becomes unresponsive

Possible Solution

No response

Additional Information/Context

I start the ssm session like this:

aws ssm start-session --target i-0ac4445bb00XXXXXX
Starting session with SessionId: [email protected]
sh-4.2$ id
uid=1001(ssm-user) gid=1007(ssm-user) groups=1007(ssm-user) context=system_u:system_r:unconfined_service_t:s0

Then I wait a couple of minutes and press a random key:

sh-4.2$ Cannot perform start session: write tcp 172.22.193.94:55404->193.106.225.65:8080: write: broken pipe

The session is terminated due to some timeout. The problem occurs after this, as my terminal becomes unusable for further commands, nothing appears on my screen any more as I type.

CLI version used

aws-cli/2.9.12 Python/3.9.11 Linux/5.10.16.3-microsoft-standard-WSL2 exe/x86_64.ubuntu.22 prompt/off

Environment details (OS name and version, etc.)

Windows 10 Enterprise, WSL 2, Ubuntu 2020

@matthewdoughertyNJ
Copy link

I see the same behavior. I increased the ECS timeout and the cloud9 timeout but the SSM terminal still freezes where I have to kill the process. It also may be related to the fact that ssm connects me to ssm-user and then I sudo to ec2-user. That shell in the middle may confuse things. I suspect that the ssm-user account has a timeout but it's not being used.

@bencehornak-gls
Copy link
Author

Any progress on this? This issue prevents the whole company to replace shared secret based SSH authentication with the more secure AWS SSM.

@Florent-Mendoza
Copy link

Florent-Mendoza commented Aug 30, 2023

Hello @bencehornak-gls, I have the same issue, it's annoying, however there is a quick workaround : when this happen, type "reset" in your term and enter => your term will be back to normal.

@Joshua-rose
Copy link

@Florent-Mendoza that does return the terminal to functional. However, it removes all anything already printed out via stdout in the terminal as well.

Previously using Windows Terminal, I did not lose any functionality after ssm timeout disconnection.

@Joshua-rose
Copy link

After testing. using tset brings back the usefulness of the terminal without losing the stdout history. Ubuntu Manpage: tset,reset

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants