Page MenuHomePhabricator

Labs-Vagrant cannot reuse the same HTTP(S) port after vagrant reload
Open, LowPublic

Description

After doing vagrant reload on a Labs-Vagrant instance (or enabling a role that forces it), it complains about ports 8080 and 443 already being in use (even though they are not, according to lsof). Changing the ports works, but only until the next reload when those too become become unusuable (and the old ones stay that way as well).

Workaround: vagrant config http_port $((`vagrant config --get http_port` 1)), vagrant config https_port $((`vagrant config --get https_port` 1)), vagrant provision, update web proxies, make sure the ports are included in the security group used by the vagrant box.

Event Timeline

The first line of a vagrant reload is Clearing any previously set forwarded ports... so I imagine that step fails somehow.

ps shows a bunch of processes like

2302 ?        Ss     0:00 redir 0.0.0.0 8080 10.0.3.225 8080
2321 ?        Ss     0:00 redir 0.0.0.0 4430 10.0.3.225 443
2338 ?        Ss     0:00 redir 0.0.0.0 1970 10.0.3.225 1970
2357 ?        Ss     0:00 redir 0.0.0.0 7231 10.0.3.225 7231
2378 ?        Ss     0:00 redir 0.0.0.0 8000 10.0.3.225 8000
4123 ?        Ss     0:00 redir 0.0.0.0 2200 10.0.3.225 1970
4143 ?        Ss     0:00 redir 0.0.0.0 2201 10.0.3.225 7231
4161 ?        Ss     0:00 redir 0.0.0.0 2202 10.0.3.225 8000

I tried to kill those which made vagrant inoperable (NFS requires a host-only network to be created.); after re-running puppet on the host, it again complains about the ports being in use.

vagrant port gives The lxc provider does not support listing forwarded ports on an LXC-based box so I imagine Vagrant has to store the list of forwarded ports in some temporary file for LXC and that gets out of sync.

Also, vagrant up messes up the terminal. Not sure if that's related.

I have seen this intermittently as well in the past. My 'fix' has been to either (a) keep trying until vagrant destroy -f; vagrant up works mysteriously, or (b) reboot the Cloud VPS instance to clear all of the bridge networking state. It has definitely seemed to be an issue with Vagrant, LXC, and the bridge network to the LXC container not working well together.

Reboots did not work, and a destroy/recreate would be expensive. Changing the ports works well enough, if slightly annoying.

Tgr renamed this task from Labs-Vagrant HTTP(S) port gets stuck to Labs-Vagrant cannot reuse the same HTTP(S) port after vagrant reload.May 30 2018, 4:46 PM
Tgr updated the task description. (Show Details)
Vvjjkkii renamed this task from Labs-Vagrant cannot reuse the same HTTP(S) port after vagrant reload to 0zbaaaaaaa.Jul 1 2018, 1:07 AM
Vvjjkkii triaged this task as High priority.
Vvjjkkii updated the task description. (Show Details)
Vvjjkkii removed a subscriber: Aklapper.
CommunityTechBot renamed this task from 0zbaaaaaaa to Labs-Vagrant cannot reuse the same HTTP(S) port after vagrant reload.Jul 2 2018, 4:25 AM
CommunityTechBot raised the priority of this task from High to Needs Triage.
CommunityTechBot updated the task description. (Show Details)
CommunityTechBot added a subscriber: Aklapper.
Aklapper triaged this task as Low priority.Dec 6 2022, 10:26 AM