diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d050f890..2cc7009f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ BUG FIXES: - core: `Guest#capability?` now works with strings as well - core: Fix NoMethodError in the new `Vagrant.has_plugin?` method [GH-2189] - core: Convert forwarded port parameters to integers. [GH-2173] + - core: Don't spike CPU to 100% while waiting for machine to boot. [GH-2163] - hosts/arch: NFS exporting works properly, no exceptions. [GH-2161] - hosts/bsd: Use only `sudo` for writing NFS exports. This lets NFS exports work if you have sudo privs but not `su`. [GH-2191] diff --git a/lib/vagrant/action/builtin/wait_for_communicator.rb b/lib/vagrant/action/builtin/wait_for_communicator.rb index 4748273e7..f2b7e8408 100644 --- a/lib/vagrant/action/builtin/wait_for_communicator.rb +++ b/lib/vagrant/action/builtin/wait_for_communicator.rb @@ -34,12 +34,18 @@ module Vagrant # Otherwise, periodically verify the VM isn't in a bad state. while true state = env[:machine].provider.state.id + # Used to report invalid states Thread.current[:last_known_state] = state + + # Check if we have the proper state so we can break out if !@states.include?(state) Thread.current[:result] = false break end + + # Sleep a bit so we don't hit 100% CPU constantly. + sleep 1 end end diff --git a/lib/vagrant/plugin/v2/communicator.rb b/lib/vagrant/plugin/v2/communicator.rb index 2f4d0b590..1ac8ef1bb 100644 --- a/lib/vagrant/plugin/v2/communicator.rb +++ b/lib/vagrant/plugin/v2/communicator.rb @@ -55,7 +55,7 @@ module Vagrant Timeout.timeout(duration) do while true return true if ready? - sleep 0.2 + sleep 0.5 end end rescue Timeout::Error