mitchellh/vagrant — Issue #767: Issue with port forward collision detection
Author: ferrylandzaat
Created: 2012-02-28 13:29:31+00:00
State: open

We recently started using vagrant for our automated tests in Jenkins, to create virtual machines on demand, and this usage has grown to a point where we are now running into issues with ssh port forwards. When 2 jobs are started around the same time, they end up on the same port. There was 1 job already running, and 2 others got started automatically after a build. The 2 new ones both ended up being moved to 2200, so both machines were being used at the same time and everything went wrong. Also, one of them was unable to shut down. "Vagrant halt" says: "SSH connection was refused! This usually happens if the VM failed to boot properly."

I don't know much about ruby, else I would dive into the code myself, so I don't know how it's being done right now, but the collision detection does not seem very reliable. Maybe it's being done too far in advance and should be moved to later in the process, or maybe making the port assignments more random (instead of always starting from 2200) could be a solution.
Can you please fix this?