Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

Don't error out when connection is lost #14

Open
patcon opened this issue May 13, 2013 · 4 comments
Open

Don't error out when connection is lost #14

patcon opened this issue May 13, 2013 · 4 comments

Comments

@patcon
Copy link
Contributor

patcon commented May 13, 2013

Below is the stacktrace I got when I lost internet connection during vagrant up. Would be nice if the plugin were a little more resilient to dropped connections. Perhaps it could inform you that the connection appears lost, and give you the option to exit or retry and pick up where it left off?

[default]  -- Image: Ubuntu 10.04 LTS (Lucid Lynx)
[default]  -- Name: testing123-ci
[default] Waiting for the server to be built...
Progress: 0%/Users/patcon/.vagrant.d/gems/gems/excon-0.21.0/lib/excon/socket.rb:177:in `rescue in block in connect': connect timeout reached (Excon::Errors::Timeout)
    from /Users/patcon/.vagrant.d/gems/gems/excon-0.21.0/lib/excon/socket.rb:156:in `block in connect'
    from /Users/patcon/.vagrant.d/gems/gems/excon-0.21.0/lib/excon/socket.rb:152:in `each'
    from /Users/patcon/.vagrant.d/gems/gems/excon-0.21.0/lib/excon/socket.rb:152:in `connect'
    from /Users/patcon/.vagrant.d/gems/gems/excon-0.21.0/lib/excon/ssl_socket.rb:92:in `connect'
    from /Users/patcon/.vagrant.d/gems/gems/excon-0.21.0/lib/excon/socket.rb:32:in `initialize'
    from /Users/patcon/.vagrant.d/gems/gems/excon-0.21.0/lib/excon/ssl_socket.rb:8:in `initialize'
    from /Users/patcon/.vagrant.d/gems/gems/excon-0.21.0/lib/excon/connection.rb:359:in `new'
    from /Users/patcon/.vagrant.d/gems/gems/excon-0.21.0/lib/excon/connection.rb:359:in `socket'
    from /Users/patcon/.vagrant.d/gems/gems/excon-0.21.0/lib/excon/connection.rb:105:in `request_call'
    from /Users/patcon/.vagrant.d/gems/gems/excon-0.21.0/lib/excon/middlewares/mock.rb:55:in `request_call'
    from /Users/patcon/.vagrant.d/gems/gems/excon-0.21.0/lib/excon/middlewares/instrumentor.rb:22:in `request_call'
    from /Users/patcon/.vagrant.d/gems/gems/excon-0.21.0/lib/excon/middlewares/base.rb:15:in `request_call'
    from /Users/patcon/.vagrant.d/gems/gems/excon-0.21.0/lib/excon/middlewares/base.rb:15:in `request_call'
    from /Users/patcon/.vagrant.d/gems/gems/excon-0.21.0/lib/excon/connection.rb:238:in `request'
    from /Users/patcon/.vagrant.d/gems/gems/fog-1.10.1/lib/fog/core/connection.rb:21:in `request'
    from /Users/patcon/.vagrant.d/gems/gems/fog-1.10.1/lib/fog/rackspace/compute_v2.rb:141:in `request'
    from /Users/patcon/.vagrant.d/gems/gems/fog-1.10.1/lib/fog/rackspace/requests/compute_v2/get_server.rb:45:in `get_server'
    from /Users/patcon/.vagrant.d/gems/gems/fog-1.10.1/lib/fog/rackspace/models/compute_v2/servers.rb:57:in `get'
    from /Users/patcon/.vagrant.d/gems/gems/fog-1.10.1/lib/fog/core/model.rb:40:in `reload'
    from /Users/patcon/.vagrant.d/gems/gems/fog-1.10.1/lib/fog/core/model.rb:66:in `block in wait_for'
    from /Users/patcon/.vagrant.d/gems/gems/fog-1.10.1/lib/fog/core/wait_for.rb:5:in `wait_for'
    from /Users/patcon/.vagrant.d/gems/gems/fog-1.10.1/lib/fog/core/model.rb:65:in `wait_for'
    from /Users/patcon/.vagrant.d/gems/gems/vagrant-rackspace-0.1.1/lib/vagrant-rackspace/action/create_server.rb:80:in `block in call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/util/retryable.rb:17:in `retryable'
    from /Users/patcon/.vagrant.d/gems/gems/vagrant-rackspace-0.1.1/lib/vagrant-rackspace/action/create_server.rb:70:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/warden.rb:34:in `call'
    from /Users/patcon/.vagrant.d/gems/gems/vagrant-rackspace-0.1.1/lib/vagrant-rackspace/action/warn_networks.rb:14:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/warden.rb:34:in `call'
    from /Users/patcon/.vagrant.d/gems/gems/vagrant-rackspace-0.1.1/lib/vagrant-rackspace/action/sync_folders.rb:17:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/builtin/call.rb:57:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/builtin/config_validate.rb:25:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/builtin/provision.rb:45:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/warden.rb:34:in `call'
    from /Users/patcon/.vagrant.d/gems/gems/vagrant-librarian-chef-0.0.1/lib/vagrant-librarian-chef/action/librarian_chef.rb:18:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/warden.rb:34:in `call'
    from /Users/patcon/.vagrant.d/gems/gems/vagrant-rackspace-0.1.1/lib/vagrant-rackspace/action/connect_rackspace.rb:32:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/runner.rb:61:in `block in run'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/util/busy.rb:19:in `busy'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/runner.rb:61:in `run'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/builtin/call.rb:51:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/builtin/config_validate.rb:25:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/builder.rb:116:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/runner.rb:61:in `block in run'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/util/busy.rb:19:in `busy'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/runner.rb:61:in `run'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/machine.rb:147:in `action'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/batch_action.rb:63:in `block (2 levels) in run'
@derks
Copy link

derks commented Jun 5, 2014

Been getting this a lot recently as well. Is there any way to extend the timeout?

@krames
Copy link
Collaborator

krames commented Jun 5, 2014

@derks I believe the issue is contained in this line. It does not look like it is currently configurable.

I will certainly add it to my list of things to do. In the meantime, if you would like to try a shot at introducing a configurable timeout I would certainly be able to help you out.

@maxlinc
Copy link
Contributor

maxlinc commented Jun 5, 2014

@krames It should be pretty resilient because of this line:
https://github.com/mitchellh/vagrant-rackspace/blob/master/lib/vagrant-rackspace/action/create_server.rb#L85

I believe the default timeout is 60 seconds, and it's supposed to poll the server up to 200 times. However I see something odd: the retry is on Fog::Errors::TimeoutError but the stacktrace shows Excon::Errors::Timeout. Maybe it's just the way the error message is being displayed, but it doesn't hurt to retry on either error.

You may also want to look at Excon's :idempotent option for requests... it means "this request can be repeated safely, so retry on errors up to 3 times". It's used quite a bit in fog, but isn't used by Rackspace Get Server.

@lzap
Copy link

lzap commented Jan 4, 2017

Hey, I am getting many of these recently, made a patch which fixes it. You were right about the incorrect exception name @maxlinc. We need to catch both, it does not work with just one of these. #14

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants