What does the OpenSSL::SSL::SSLErrorWaitReadable "read would block"
mean?
I am getting the error OpenSSL::SSL::SSLErrorWaitReadable
with the message read would block
. I think this is because of timeouts, but I can't find any documentation on the subject.
Can anyone help me figure out what is causing this? Also what I can do to prevent the issue?
The code that is producing this error every now and then:
data = {hello: "world"}
path = "https://example.com/api"
uri = URI.parse(path)
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = (uri.scheme == "https")
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
request = Net::HTTP::Post.new(uri.request_uri)
request.body = Oj.dump(data)
request["Content-Type"] = "application/json"
begin
response = http.request(request) #this line produces the error.
rescue
return nil
end
I am using ruby version 2.1.5p273
and openssl version 1.0.1i
on osx 10.10.3
.
Versions are found using the command ruby -v -ropenssl -rfiddle -e 'puts Fiddle::Function.new(Fiddle.dlopen(nil)["SSLeay_version"], [Fiddle::TYPE_INT], Fiddle::TYPE_VOIDP).call(0)'
Thanks to @bayendor