excon: Excon::Error::Socket: getaddrinfo: No address associated with hostname (SocketError)
Rails 4.2.0 Ruby 2.2.2 Amazon AWS S3 fog-aws 0.10.0 Excon 0.51.0
Around 99% of the time we have no issues. The issue usually only happens during times when usage is high but I noticed it happen when there were almost no users as well. The line that throws the error:
# excon/lib/excon/socket.rb
# line 100 inside the connection method.
addrinfo = ::Socket.getaddrinfo(*args)
The error happens everywhere in the application. It does not seem to matter if I am requesting another url or one of the routes for our site.
I used Rails loggers to capture the arguments being passed in and there is seemingly no difference between a pass and a fail.
I came across several forums that lead me to believe an update was needed to the excon gem. I upgraded the Excon gem from 0.45.4 to 0.51.0. In addition to that I also updated the Fog gem from 1.36.0 to 1.38.0.
After upgrading the error went from “getaddrinfo: Name or service not known (SocketError)” to “Excon::Error::Socket: getaddrinfo: No address associated with hostname (SocketError)”
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 24 (7 by maintainers)
Hey, I believe you should just be able to add a one-liner, prior to any connections being initialized like this:
Excon.defaults[:omit_default_port] = trueThat will override the default value used, which means it will be omitted unless the library explicitly sets it (and I’m fairly sure fog does not). The only other caveat, as mentioned above, is that this needs to occur PRIOR to connection initialization or it won’t take effect. More info here: https://github.com/excon/excon#options
/etc/hosts 127.0.0.1 localhost 127.0.1.1 09348-23409-3294393