Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined method `response' for #<Excon::Errors::SocketError:0x0000001044da08> #789

Closed
manuelmeurer opened this issue Mar 11, 2012 · 14 comments

Comments

@manuelmeurer
Copy link
Contributor

I'm getting this error when trying to use the backup gem. I updated the gem to a new version, so it may very well be that my configuration is incorrect and causes this error in the first place, but it seems to be a bug in fog because it tries to call response on a Excon::Errors::SocketError which doesn't have a response method.
Fog seems to expect a HTTPStatusError or a descendent thereof, which has a response method.
The errors are defined in https://github.com/geemus/excon/blob/master/lib/excon/errors.rb
A simple respond_to?(:response) call should fix this...?

Backtrace:

.../gems/fog-1.1.2/lib/fog/aws/requests/storage/sync_clock.rb:12:in `rescue in sync_clock'
.../gems/fog-1.1.2/lib/fog/aws/requests/storage/sync_clock.rb:9:in `sync_clock'
.../gems/backup-3.0.23/lib/backup/storage/s3.rb:61:in `transfer!'
.../gems/backup-3.0.23/lib/backup/storage/base.rb:33:in `perform!'
.../gems/backup-3.0.23/lib/backup/model.rb:245:in `each'
.../gems/backup-3.0.23/lib/backup/model.rb:245:in `block in perform!'
.../gems/backup-3.0.23/lib/backup/model.rb:243:in `each'
.../gems/backup-3.0.23/lib/backup/model.rb:243:in `perform!'
.../gems/backup-3.0.23/lib/backup/cli/utility.rb:74:in `block in perform'
.../gems/backup-3.0.23/lib/backup/cli/utility.rb:65:in `each'
.../gems/backup-3.0.23/lib/backup/cli/utility.rb:65:in `perform'
.../gems/thor-0.14.6/lib/thor/task.rb:22:in `run'
.../gems/thor-0.14.6/lib/thor/invocation.rb:118:in `invoke_task'
.../gems/thor-0.14.6/lib/thor.rb:263:in `dispatch'
.../gems/thor-0.14.6/lib/thor/base.rb:389:in `start'
.../gems/backup-3.0.23/bin/backup:11:in `<top (required)>'
.../bin/backup:19:in `load'
.../bin/backup:19:in `<main>'
@geemus
Copy link
Member

geemus commented Mar 12, 2012

@manuelmeurer You are correct that SocketError isn't really expected here, but that it should be handled if it comes up. I think the respond_to you mentioned should handle it nicely. Could you create a pull request with that change? Thanks!

@freeformz
Copy link

I don't think using respond_to? in this way is the right thing to do here.

if response gets set to error.message, error.message will not have a .headers method/attribute causing a different exception a few lines down when Fog::Time.now is set.

Any chance you can duplicate now and provide the exact SocketError message?

I think it may be a configuration issue and Fog should probably handle that better.

@geemus
Copy link
Member

geemus commented Mar 12, 2012

@freeformz you make a good point, I hadn't considered the .headers requirement shortly thereafter.

@manuelmeurer
Copy link
Contributor Author

Yes, you are right. Maybe it would be best to just rescue HTTPStatusError, because we can be sure they have a response method, and let a SocketError bubble up?
I will try the current master and see what the error exactly is.

@manuelmeurer
Copy link
Contributor Author

On top of what @freeformz noticed I wrote respond_to instead of respond_to? so that was not one of my finest moments. :)
@geemus, please pull in the fix in above referenced pull request. Using that, the exception in my case becomes:

[2012/03/13 09:40:51][error]   Excon::Errors::SocketError
[2012/03/13 09:40:51][error]   Unable to verify certificate, please set `Excon.defaults[:ssl_ca_path] = path_to_certs`, `Excon.defaults[:ssl_ca_file] = path_to_file`, or `Excon.defaults[:ssl_verify_peer] = false` (less secure).
[2012/03/13 09:40:51][error] 
[2012/03/13 09:40:51][error] Backtrace:
[2012/03/13 09:40:51][error]   /home/rails/myapp/shared/bundle/ruby/1.9.1/gems/excon-0.10.0/lib/excon/ssl_socket.rb:64:in `connect'
[2012/03/13 09:40:51][error]   /home/rails/myapp/shared/bundle/ruby/1.9.1/gems/excon-0.10.0/lib/excon/ssl_socket.rb:64:in `initialize'
[2012/03/13 09:40:51][error]   /home/rails/myapp/shared/bundle/ruby/1.9.1/gems/excon-0.10.0/lib/excon/connection.rb:303:in `new'
[2012/03/13 09:40:51][error]   /home/rails/myapp/shared/bundle/ruby/1.9.1/gems/excon-0.10.0/lib/excon/connection.rb:303:in `socket'
[2012/03/13 09:40:51][error]   /home/rails/myapp/shared/bundle/ruby/1.9.1/gems/excon-0.10.0/lib/excon/connection.rb:148:in `request_kernel'
[2012/03/13 09:40:51][error]   /home/rails/myapp/shared/bundle/ruby/1.9.1/gems/excon-0.10.0/lib/excon/connection.rb:92:in `request'
[2012/03/13 09:40:51][error]   /home/rails/myapp/shared/bundle/ruby/1.9.1/bundler/gems/fog-2a4abcd092b7/lib/fog/core/connection.rb:20:in `request'
[2012/03/13 09:40:51][error]   /home/rails/myapp/shared/bundle/ruby/1.9.1/bundler/gems/fog-2a4abcd092b7/lib/fog/aws/storage.rb:359:in `request'
[2012/03/13 09:40:51][error]   /home/rails/myapp/shared/bundle/ruby/1.9.1/bundler/gems/fog-2a4abcd092b7/lib/fog/aws/requests/storage/get_service.rb:32:in `get_service'
[2012/03/13 09:40:51][error]   /home/rails/myapp/shared/bundle/ruby/1.9.1/bundler/gems/fog-2a4abcd092b7/lib/fog/aws/requests/storage/sync_clock.rb:10:in `sync_clock'
[2012/03/13 09:40:51][error]   /home/rails/myapp/shared/bundle/ruby/1.9.1/gems/backup-3.0.23/lib/backup/storage/s3.rb:61:in `transfer!'
[2012/03/13 09:40:51][error]   /home/rails/myapp/shared/bundle/ruby/1.9.1/gems/backup-3.0.23/lib/backup/storage/base.rb:33:in `perform!'
[2012/03/13 09:40:51][error]   /home/rails/myapp/shared/bundle/ruby/1.9.1/gems/backup-3.0.23/lib/backup/model.rb:245:in `each'
[2012/03/13 09:40:51][error]   /home/rails/myapp/shared/bundle/ruby/1.9.1/gems/backup-3.0.23/lib/backup/model.rb:245:in `block in perform!'
[2012/03/13 09:40:51][error]   /home/rails/myapp/shared/bundle/ruby/1.9.1/gems/backup-3.0.23/lib/backup/model.rb:243:in `each'
[2012/03/13 09:40:51][error]   /home/rails/myapp/shared/bundle/ruby/1.9.1/gems/backup-3.0.23/lib/backup/model.rb:243:in `perform!'
[2012/03/13 09:40:51][error]   /home/rails/myapp/shared/bundle/ruby/1.9.1/gems/backup-3.0.23/lib/backup/cli/utility.rb:74:in `block in perform'
[2012/03/13 09:40:51][error]   /home/rails/myapp/shared/bundle/ruby/1.9.1/gems/backup-3.0.23/lib/backup/cli/utility.rb:65:in `each'
[2012/03/13 09:40:51][error]   /home/rails/myapp/shared/bundle/ruby/1.9.1/gems/backup-3.0.23/lib/backup/cli/utility.rb:65:in `perform'
[2012/03/13 09:40:51][error]   /home/rails/myapp/shared/bundle/ruby/1.9.1/gems/thor-0.14.6/lib/thor/task.rb:22:in `run'
[2012/03/13 09:40:51][error]   /home/rails/myapp/shared/bundle/ruby/1.9.1/gems/thor-0.14.6/lib/thor/invocation.rb:118:in `invoke_task'
[2012/03/13 09:40:51][error]   /home/rails/myapp/shared/bundle/ruby/1.9.1/gems/thor-0.14.6/lib/thor.rb:263:in `dispatch'
[2012/03/13 09:40:51][error]   /home/rails/myapp/shared/bundle/ruby/1.9.1/gems/thor-0.14.6/lib/thor/base.rb:389:in `start'
[2012/03/13 09:40:51][error]   /home/rails/myapp/shared/bundle/ruby/1.9.1/gems/backup-3.0.23/bin/backup:11:in `<top (required)>'
[2012/03/13 09:40:51][error]   /home/rails/myapp/shared/bundle/ruby/1.9.1/bin/backup:19:in `load'
[2012/03/13 09:40:51][error]   /home/rails/myapp/shared/bundle/ruby/1.9.1/bin/backup:19:in `<main>'

@manuelmeurer
Copy link
Contributor Author

The error only happens with fog 1.1.2, with 1.1.1 all works fine (using same version of excon and backup gem).
Any idea what might cause this?

@manuelmeurer
Copy link
Contributor Author

Sorry, fog 1.1.1 uses an older version of the Excon gem (0.7.12) which might be the issue.

@geemus
Copy link
Member

geemus commented Mar 13, 2012

@manuelmeurer yep, older excon did not ssl verify by default, but new excon does do so.

@hasanove
Copy link

I have tried to apply this patch yesterday and noticed, that it should be "respond_to?" not "respond_to"

@manuelmeurer
Copy link
Contributor Author

@hasanove #792 fixes that.

@shyam-habarakada
Copy link

I just ran into the same issue with a newly build ubuntu server. It does not happen with an older ubuntu server I've been using for staging. I have,

backup (3.0.23)
fog (1.1.2)
excon (0.9.6)
    excon (~> 0.9.0)

The fact that it only fails in one of these servers is making me think that this could be a dependency that is missing. Will look into this some more and report back if I find something

@geemus
Copy link
Member

geemus commented Mar 26, 2012

@shyam-habarakada - thanks for the update. I think this fix was in fog 1.2, so you may need to update in order to take advantage of it.

@semaperepelitsa
Copy link

@geemus aren't bug fixes supposed to go into patch-level releases? I mean 1.1.2 -> 1.1.3.

@geemus
Copy link
Member

geemus commented Mar 28, 2012

@semaperepelitsa - generally yes, but some other larger things were released at the same time which seemed to warrant the minor bump. Sorry for the confusion.

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

No branches or pull requests

6 participants