I\'m consistently getting this error on several hosts on my machine, e.g.:
require \'open-uri\'
open(\'https://google.com\').read
Net::OpenTimeout: execution e
I've hit another reason for this issue. Had a network where IPv6 is announced as routable but is not. That lead to IPv6 trying to be used resulting in the error.
So I had to disable IPv6.
For Red Hat Enterprise Linux 7:
# cat /etc/sysctl.d/10-ipv6.conf
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
# sysctl -p
The require 'resolv-replace'
also helped but my guess is that it just resolved to IPv4 instead so I don't want to limit app in such a way.
Looks like it's a an issue with how Ruby resolves DNS.
Added require 'resolv-replace'
and now it's opening connections immediately.
Sources: https://stackoverflow.com/a/27485369/116925 https://github.com/ruby/ruby/pull/597#issuecomment-40507119
I received error from rails application in docker container, and restarting docker service solved the problem:
sudo service docker start