klacointe / wikidata-client

Wikidata and Wikipedia API client.
MIT License
35 stars 18 forks source link

Faraday Connection failed - comparison of Integer with Range failed #28

Open dshorthouse opened 3 years ago

dshorthouse commented 3 years ago

Not sure how to sort this one. I'm calling Wikidata::Item.find(wikicode) in a transaction and I get the following:

App 3887 output: 2021-04-20 00:22:13 - Faraday::ConnectionFailed - comparison of Integer with Range failed (ArgumentError):
App 3887 output:    /home/dshorthouse/.rvm/gems/ruby-2.7.1@bionomia/gems/rubysl-securerandom-2.0.0/lib/rubysl/securerandom/securerandom.rb:215:in `<'
App 3887 output:    /home/dshorthouse/.rvm/gems/ruby-2.7.1@bionomia/gems/rubysl-securerandom-2.0.0/lib/rubysl/securerandom/securerandom.rb:215:in `random_number'
App 3887 output:    /usr/share/rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/resolv.rb:606:in `random'
App 3887 output:    /usr/share/rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/resolv.rb:646:in `bind_random_port'
App 3887 output:    /usr/share/rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/resolv.rb:757:in `block (2 levels) in lazy_initialize'
App 3887 output:    /usr/share/rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/resolv.rb:740:in `each'
App 3887 output:    /usr/share/rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/resolv.rb:740:in `block in lazy_initialize'
App 3887 output:    /usr/share/rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/resolv.rb:735:in `synchronize'
App 3887 output:    /usr/share/rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/resolv.rb:735:in `lazy_initialize'
App 3887 output:    /usr/share/rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/resolv.rb:770:in `sender'
App 3887 output:    /usr/share/rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/resolv.rb:527:in `block in fetch_resource'
App 3887 output:    /usr/share/rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/resolv.rb:1124:in `block (3 levels) in resolv'
App 3887 output:    /usr/share/rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/resolv.rb:1122:in `each'
App 3887 output:    /usr/share/rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/resolv.rb:1122:in `block (2 levels) in resolv'
App 3887 output:    /usr/share/rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/resolv.rb:1121:in `each'
App 3887 output:    /usr/share/rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/resolv.rb:1121:in `block in resolv'
App 3887 output:    /usr/share/rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/resolv.rb:1119:in `each'
App 3887 output:    /usr/share/rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/resolv.rb:1119:in `resolv'
App 3887 output:    /usr/share/rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/resolv.rb:521:in `fetch_resource'
App 3887 output:    /usr/share/rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/resolv.rb:507:in `each_resource'
App 3887 output:    /usr/share/rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/resolv.rb:402:in `each_address'
App 3887 output:    /usr/share/rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/resolv.rb:116:in `block in each_address'
App 3887 output:    /usr/share/rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/resolv.rb:115:in `each'
App 3887 output:    /usr/share/rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/resolv.rb:115:in `each_address'
App 3887 output:    /usr/share/rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/resolv.rb:58:in `each_address'
App 3887 output:    /home/dshorthouse/.rvm/gems/ruby-2.7.1@bionomia/gems/excon-0.80.1/lib/excon/socket.rb:110:in `connect'
App 3887 output:    /home/dshorthouse/.rvm/gems/ruby-2.7.1@bionomia/gems/excon-0.80.1/lib/excon/ssl_socket.rb:166:in `connect'
App 3887 output:    /home/dshorthouse/.rvm/gems/ruby-2.7.1@bionomia/gems/excon-0.80.1/lib/excon/socket.rb:49:in `initialize'
App 3887 output:    /home/dshorthouse/.rvm/gems/ruby-2.7.1@bionomia/gems/excon-0.80.1/lib/excon/ssl_socket.rb:10:in `initialize'
App 3887 output:    /home/dshorthouse/.rvm/gems/ruby-2.7.1@bionomia/gems/excon-0.80.1/lib/excon/connection.rb:471:in `new'
App 3887 output:    /home/dshorthouse/.rvm/gems/ruby-2.7.1@bionomia/gems/excon-0.80.1/lib/excon/connection.rb:471:in `socket'
App 3887 output:    /home/dshorthouse/.rvm/gems/ruby-2.7.1@bionomia/gems/excon-0.80.1/lib/excon/connection.rb:118:in `request_call'
App 3887 output:    /home/dshorthouse/.rvm/gems/ruby-2.7.1@bionomia/gems/excon-0.80.1/lib/excon/middlewares/mock.rb:57:in `request_call'
App 3887 output:    /home/dshorthouse/.rvm/gems/ruby-2.7.1@bionomia/gems/excon-0.80.1/lib/excon/middlewares/instrumentor.rb:34:in `request_call'
App 3887 output:    /home/dshorthouse/.rvm/gems/ruby-2.7.1@bionomia/gems/excon-0.80.1/lib/excon/middlewares/idempotent.rb:19:in `request_call'
App 3887 output:    /home/dshorthouse/.rvm/gems/ruby-2.7.1@bionomia/gems/excon-0.80.1/lib/excon/middlewares/base.rb:22:in `request_call'
App 3887 output:    /home/dshorthouse/.rvm/gems/ruby-2.7.1@bionomia/gems/excon-0.80.1/lib/excon/middlewares/base.rb:22:in `request_call'
App 3887 output:    /home/dshorthouse/.rvm/gems/ruby-2.7.1@bionomia/gems/excon-0.80.1/lib/excon/connection.rb:283:in `request'
App 3887 output:    /home/dshorthouse/.rvm/gems/ruby-2.7.1@bionomia/gems/faraday-0.17.4/lib/faraday/adapter/excon.rb:52:in `call'
App 3887 output:    /home/dshorthouse/.rvm/gems/ruby-2.7.1@bionomia/gems/faraday_middleware-0.14.0/lib/faraday_middleware/response_middleware.rb:31:in `call'
App 3887 output:    /home/dshorthouse/.rvm/gems/ruby-2.7.1@bionomia/gems/faraday-0.17.4/lib/faraday/request/url_encoded.rb:15:in `call'
App 3887 output:    /home/dshorthouse/.rvm/gems/ruby-2.7.1@bionomia/gems/faraday-0.17.4/lib/faraday/rack_builder.rb:143:in `build_response'
App 3887 output:    /home/dshorthouse/.rvm/gems/ruby-2.7.1@bionomia/gems/faraday-0.17.4/lib/faraday/connection.rb:387:in `run_request'
App 3887 output:    /home/dshorthouse/.rvm/gems/ruby-2.7.1@bionomia/gems/faraday-0.17.4/lib/faraday/connection.rb:138:in `get'
App 3887 output:    /home/dshorthouse/.rvm/gems/ruby-2.7.1@bionomia/gems/wikidata-client-0.0.12/lib/wikidata/client.rb:14:in `response'
App 3887 output:    /home/dshorthouse/.rvm/gems/ruby-2.7.1@bionomia/gems/wikidata-client-0.0.12/lib/wikidata/item.rb:29:in `_find'
App 3887 output:    /home/dshorthouse/.rvm/gems/ruby-2.7.1@bionomia/gems/wikidata-client-0.0.12/lib/wikidata/item.rb:18:in `find'
dshorthouse commented 3 years ago

For what it's worth, I've sidestepped the issue by making use of typhoeus instead of defaults that are evidently causing problems. This now works for me

      Wikidata.configure do |config|
        config.options = {
          request: {
            timeout: 20,
            open_timeout: 20
          }
        }
        config.faraday = -> (builder) { builder.adapter :typhoeus }
      end
klacointe commented 2 years ago

Can you submit a complete failing example plz ?