ruby net/http sysread_nonblock: end of file reached (EOFError) -


i have following code:

#!/usr/bin/env ruby  require 'net/http'  token = file.read("code.txt") uri = uri("https://private.http.server.with.self.signed.certs") http = net::http.new(uri.host, uri.port) http.use_ssl = true http.verify_mode = openssl::ssl::verify_none retjson = http.get("/api/conf/"+token) puts retjson.body 

and works fine on macbookpro13 mid 2010 8gb ram.

the same code on new macbookpro15 mid 2014 16gb raises following exception:

/users/lc/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/openssl/buffering.rb:174:in `sysread_nonblock': end of file reached (eoferror) /users/lc/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/openssl/buffering.rb:174:in `read_nonblock' /users/lc/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/net/protocol.rb:141:in `rbuf_fill' /users/lc/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/net/protocol.rb:122:in `readuntil' /users/lc/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/net/protocol.rb:132:in `readline' /users/lc/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/net/http.rb:2563:in `read_status_line' /users/lc/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/net/http.rb:2552:in `read_new' /users/lc/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/net/http.rb:1320:in `block in transport_request' /users/lc/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/net/http.rb:1317:in `catch' /users/lc/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/net/http.rb:1317:in `transport_request' /users/lc/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/net/http.rb:1294:in `request' /users/lc/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/net/http.rb:1287:in `block in request' /users/lc/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/net/http.rb:746:in `start' /users/lc/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/net/http.rb:1285:in `request' /users/lc/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/net/http.rb:1027:in `get' a.rb:10:in `<main>' 

on both machines have same installation of ruby 1.9.3-p551 , same gems.

if remove file.read line, exception magically disappears, this:

#!/usr/bin/env ruby  require 'net/http'  # token = file.read("code.txt") token = '56f3052f84e9b73c46df21c7d91620dc' uri = uri("https://private.http.server.with.self.signed.certs") http = net::http.new(uri.host, uri.port) http.use_ssl = true http.verify_mode = openssl::ssl::verify_none retjson = http.get("/api/conf/"+token) puts retjson.body 

googling around found net/http has random behaviour depending on concurrency level, i'm missing point.

any suggestion or pointer ?

thanks in advance luca


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -