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

builder/amazonebs: Move SSH.new into ConnectWaitLoop #138

Closed
wants to merge 1 commit into from

Conversation

sit
Copy link
Contributor

@sit sit commented Jul 5, 2013

EC2 images can sometimes accept a connection on port 22 without
truly being ready to complete SSH. For example, it may not complete
the full hand-shake (closing the connection immediately) or it may
not have the appropriate public keys in place. The prior code
would only attempt an SSH handshake once, which would unnecessarily
fail the build in these instances.

Fix #130 by moving SSH.new into the loop that retries connections,
and improve debuggability by logging the failure causes on each
connection fail.

Signed-off-by: Emil Sit [email protected]

EC2 images can sometimes accept a connection on port 22 without
truly being ready to complete SSH. For example, it may not complete
the full hand-shake (closing the connection immediately) or it may
not have the appropriate public keys in place.  The prior code
would only attempt an SSH handshake once, which would unnecessarily
fail the build in these instances.

Fix hashicorp#130 by moving SSH.new into the loop that retries connections,
and improve debuggability by logging the failure causes on each
connection fail.

Signed-off-by: Emil Sit <[email protected]>
@mitchellh
Copy link
Contributor

Ah, so unfortunately this solves one issue but introduces another. The issue is that SSH handshakes have REALLY long timeouts. But generally it is clear they're going to time out if they don't finish in around 5 or so seconds. For this reason, you actually need to do something similar to the virtualbox wait_for_ssh step:

https://github.com/mitchellh/packer/blob/da415312eecc52c5aff904a52fcc60ad6882cfa1/builder/virtualbox/step_wait_for_ssh.go#L120

This extra complicated step is the reason I haven't quickly merged this. If you want to just repurpose the VirtualBox step to AWS, I'd be open to that.

For now, I'm going to close this PR because the changes needed are pretty vast. But if you end up applying it in this way, feel free to open another PR. Thanks!

@mitchellh mitchellh closed this Jul 5, 2013
@innyso innyso mentioned this pull request Aug 1, 2013
@ghost ghost locked and limited conversation to collaborators Apr 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SSH: Retry handshake
3 participants