Variable CLI挂在Windows 10上

问题描述 投票:0回答:1

我正在公司代理后面的Windows 10上使用vagrant 2.2.5。

所有CLI命令都挂起。让我们用vagrant help来说明我的问题。

vagrant help耗时超过30秒。

Measure-Command {start-process vagrant -argumentlist "help" -Wait}


Days              : 0
Hours             : 0
Minutes           : 0
Seconds           : 36
Milliseconds      : 94
Ticks             : 360943091
TotalDays         : 0,000417758207175926
TotalHours        : 0,0100261969722222
TotalMinutes      : 0,601571818333333
TotalSeconds      : 36,0943091
TotalMilliseconds : 36094,3091

[vagrant help --debug显示它正在挂起]

DEBUG checkpoint_client: waiting for checkpoint to complete...

及以上

INFO runner: Running action: environment_unload #<Vagrant::Action::Builder:0x0000000004b32910>

[我注意到,如果我断开网络连接(飞行模式,拔掉以太网电缆),情况会好很多:

Measure-Command {start-process vagrant -argumentlist "help" -Wait}


Days              : 0
Hours             : 0
Minutes           : 0
Seconds           : 5
Milliseconds      : 14
Ticks             : 50147343
TotalDays         : 5,804090625E-05
TotalHours        : 0,00139298175
TotalMinutes      : 0,083578905
TotalSeconds      : 5,0147343
TotalMilliseconds : 5014,7343

如果配置代理,那就更好了:

$env:HTTP_PROXY="http://my.proxy.host:port"
$env:HTTPS_PROXY="http://my.proxy.host:port"


Measure-Command {start-process vagrant -argumentlist "help" -Wait}


Days              : 0
Hours             : 0
Minutes           : 0
Seconds           : 2
Milliseconds      : 24
Ticks             : 20249878
TotalDays         : 2,34373587962963E-05
TotalHours        : 0,000562496611111111
TotalMinutes      : 0,0337497966666667
TotalSeconds      : 2,0249878
TotalMilliseconds : 2024,9878

通过比较,在WSL(Linux的Windows子系统)中,在所有情况下(与连接无关),它要快得多:

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 19.04
Release:        19.04
Codename:       disco

$ time vagrant help
(...)
real    0m1.043s
user    0m0.500s
sys     0m0.469s

由于vagrant在我的WSL Ubuntu中是2.0.2版,我也在Windows上对此版本进行了测试。我有相同的行为。

windows vagrant hang
1个回答
0
投票

问题是通过某种方式访问​​网络。在我打开的issue中,Vagrant的支持进行了说明,Vag​​rant将定期检查是否有新版本,以便在有新版本时通知用户。如果网络访问速度慢或挂起,则每个命令都将等待它,因为流浪汉将尝试直到获得答案。只有这样,它才会等待一段时间,然后重试。要禁用此轮询,只需设置environment variable VAGRANT_CHECKPOINT_DISABLE

© www.soinside.com 2019 - 2024. All rights reserved.