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

If The SSH Connection Drops, Packer Does Not Detect The Dropped Connection and Hangs #200

Closed
joefitzgerald opened this issue Jul 19, 2013 · 3 comments
Labels

Comments

@joefitzgerald
Copy link

Reproduction:

  1. Use a shell script provisioner to execute somescript.sh
  2. Ensure somescript.sh has some long running operation (e.g. sleep 1800)
  3. Kill the ssh server on the VM guest
  4. Watch packer hang

To be fair, this appears to have nothing to do with Packer specifically, and more to do with the go SSH package:

@kwilczynski
Copy link
Contributor

I wonder if the same thing would happen if VirtualBox would die suddenly? Or kernel in VM panic ...

We could have small heartbeat that will "poke" SSH port and try to open it (and maybe possibly read banner), and if it fails to do it, then we could try to abort step.

@mitchellh
Copy link
Contributor

Due to the bugs in go's SSH lib, I'm a fan of @kwilczynski's idea. With the latest changes that allows SSH to reconnect (https://github.com/mitchellh/packer/blob/38ae1a0ba9eeca963166bcfa83a69ab0cdcb2104/communicator/ssh/communicator.go#L30), it would be pretty trivial I think for the communicator to actually spin off a goroutine to constantly poke it... ah hah!

@mitchellh
Copy link
Contributor

Fixed, using @kwilczynski's suggested technique. See the associated commit for more info.

hirofumi added a commit to hirofumi/packer that referenced this issue Apr 2, 2014
@ghost ghost locked and limited conversation to collaborators Apr 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants