Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bundler::HTTPError does not say what the error was #3805

Closed
p-mongo opened this issue Jul 9, 2020 · 9 comments · Fixed by #4061
Closed

Bundler::HTTPError does not say what the error was #3805

p-mongo opened this issue Jul 9, 2020 · 9 comments · Fixed by #4061

Comments

@p-mongo
Copy link

p-mongo commented Jul 9, 2020

Describe the problem as clearly as you can

When I ran bundle install I received the following output:

Fetching source index from https://rubygems.org/
Retrying fetcher due to error (2/4): Bundler::HTTPError Could not fetch specs from https://rubygems.org/

Retrying fetcher due to error (3/4): Bundler::HTTPError Could not fetch specs from https://rubygems.org/


Retrying fetcher due to error (4/4): Bundler::HTTPError Could not fetch specs from https://rubygems.org/

Could not fetch specs from https://rubygems.org/

The output says there was an error but does not say what the error was.

  • Connection refused?
  • Timeout?
  • TLS issue?
  • Bad HTTP status received?

Post system independent steps to reproduce the problem

bundle install in https://github.com/mongodb/mongo-ruby-driver

The error does not occur most of the time, it is quite rare actually.

I've only seen this error recently when installing in a docker container.

Which command did you run?

bundle install

What were you expecting to happen?

I expected bundler to clearly communicate the errors it encountered so that I could address them.

What actually happened?

Bundler said there was an error but did not specify what the error was.

If not included with the output of your command, run bundle env and paste the output below

Environment

Bundler       2.1.4
  Platforms   ruby, x86_64-linux
Ruby          2.7.1p83 (2020-03-31 revision a0c7c23c9cec0d0ffcba012279cd652d28ad5bf3) [x86_64-linux]
  Full Path   /opt/rubies/ruby-2.7.1/bin/ruby
  Config Dir  /data/mci/0af7a7fbb49b5d965e07a55f9a0d64db/mongo-ruby-toolchain/rubies/ruby-2.7.1/etc
RubyGems      3.1.2
  Gem Home    /opt/rubies/ruby-2.7.1/lib/ruby/gems/2.7.0
  Gem Path    /root/.gem/ruby/2.7.0:/opt/rubies/ruby-2.7.1/lib/ruby/gems/2.7.0
  User Home   /root
  User Path   /root/.gem/ruby/2.7.0
  Bin Dir     /opt/rubies/ruby-2.7.1/bin
Tools         
  Git         1.8.3.1
  RVM         not installed
  rbenv       not installed
  chruby      not installed

Bundler Build Metadata

Built At          2020-01-05
Git SHA           32a4159325
Released Version  true

Gemfile

Gemfile

source 'https://rubygems.org'

gemspec

require_relative './gemfiles/standard'

standard_dependencies

Gemfile.lock

PATH
  remote: .
  specs:
    mongo (2.13.0.beta1)
      bson (>= 4.8.2, < 5.0.0)

GEM
  remote: https://rubygems.org/
  specs:
    activesupport (6.0.3.2)
      concurrent-ruby (~> 1.0, >= 1.0.2)
      i18n (>= 0.7, < 2)
      minitest (~> 5.1)
      tzinfo (~> 1.1)
      zeitwerk (~> 2.2, >= 2.2.2)
    async (1.26.2)
      console (~> 1.0)
      nio4r (~> 2.3)
      timers (~> 4.1)
    async-dns (1.2.5)
      async-io (~> 1.15)
    async-io (1.30.0)
      async (~> 1.14)
    aws-eventstream (1.1.0)
    aws-partitions (1.340.0)
    aws-sdk-cloudwatchlogs (1.34.0)
      aws-sdk-core (~> 3, >= 3.99.0)
      aws-sigv4 (~> 1.1)
    aws-sdk-core (3.103.0)
      aws-eventstream (~> 1, >= 1.0.2)
      aws-partitions (~> 1, >= 1.239.0)
      aws-sigv4 (~> 1.1)
      jmespath (~> 1.0)
    aws-sdk-ec2 (1.176.0)
      aws-sdk-core (~> 3, >= 3.99.0)
      aws-sigv4 (~> 1.1)
    aws-sdk-ecs (1.67.0)
      aws-sdk-core (~> 3, >= 3.99.0)
      aws-sigv4 (~> 1.1)
    aws-sdk-iam (1.43.0)
      aws-sdk-core (~> 3, >= 3.99.0)
      aws-sigv4 (~> 1.1)
    aws-sigv4 (1.2.1)
      aws-eventstream (~> 1, >= 1.0.2)
    bson (4.9.4)
    byebug (11.1.3)
    celluloid (0.17.4)
      celluloid-essentials
      celluloid-extras
      celluloid-fsm
      celluloid-pool
      celluloid-supervision
      timers (>= 4.1.1)
    celluloid-essentials (0.20.5)
      timers (>= 4.1.1)
    celluloid-extras (0.20.5)
      timers (>= 4.1.1)
    celluloid-fsm (0.20.5)
      timers (>= 4.1.1)
    celluloid-pool (0.20.5)
      timers (>= 4.1.1)
    celluloid-supervision (0.20.6)
      timers (>= 4.1.1)
    childprocess (4.0.0)
    concurrent-ruby (1.1.6)
    console (1.8.2)
    diff-lcs (1.4.4)
    dotenv (2.7.5)
    ffi (1.13.1)
    ffi-libc (0.1.0)
      ffi (~> 1.0)
    fuubar (2.5.0)
      rspec-core (~> 3.0)
      ruby-progressbar (~> 1.4)
    i18n (1.8.3)
      concurrent-ruby (~> 1.0)
    ice_nine (0.11.2)
    jmespath (1.4.0)
    minitest (5.14.1)
    nio4r (2.5.2)
    paint (2.2.0)
    rake (13.0.1)
    rfc (0.2.0)
      rspec-core (~> 3.0)
    rspec-core (3.9.2)
      rspec-support (~> 3.9.3)
    rspec-expectations (3.9.2)
      diff-lcs (>= 1.2.0, < 2.0)
      rspec-support (~> 3.9.0)
    rspec-mocks-diag (3.9.1.1)
      diff-lcs (>= 1.2.0, < 2.0)
      rspec-support (~> 3.9.0)
    rspec-retry (0.6.2)
      rspec-core (> 3.3)
    rspec-support (3.9.3)
    ruby-prof (1.4.1)
    ruby-progressbar (1.10.1)
    rubydns (2.0.2)
      async-dns (~> 1.0)
    thread_safe (0.3.6)
    timecop (0.9.1)
    timeout-interrupt (0.3.0)
      ffi-libc
    timers (4.3.0)
    tzinfo (1.2.7)
      thread_safe (~> 0.1)
    yajl-ruby (1.4.1)
    yard (0.9.25)
    zeitwerk (2.3.1)

PLATFORMS
  ruby

DEPENDENCIES
  activesupport
  aws-sdk-cloudwatchlogs
  aws-sdk-core (~> 3)
  aws-sdk-ec2
  aws-sdk-ecs
  aws-sdk-iam
  byebug
  celluloid
  childprocess
  concurrent-ruby
  dotenv
  ffi
  fuubar
  ice_nine
  jruby-openssl
  json
  mongo!
  paint
  rake
  rfc (~> 0.2.0)
  rspec-core (~> 3.0)
  rspec-expectations (~> 3.0)
  rspec-mocks-diag (~> 3.0)
  rspec-retry
  ruby-debug
  ruby-prof
  rubydns
  timecop
  timeout-interrupt
  yajl-ruby
  yard

BUNDLED WITH
   2.1.4

Gemspecs

mongo.gemspec

lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'mongo/version'

Gem::Specification.new do |s|
  s.name              = 'mongo'
  s.version           = Mongo::VERSION
  s.platform          = Gem::Platform::RUBY

  s.authors           = ['Tyler Brock', 'Emily Stolfo', 'Durran Jordan']
  s.homepage          = 'https://docs.mongodb.com/ruby-driver/'
  s.summary           = 'Ruby driver for MongoDB'
  s.description       = 'A Ruby driver for MongoDB'
  s.license           = 'Apache-2.0'

  s.metadata = {
    'bug_tracker_uri' => 'https://jira.mongodb.org/projects/RUBY',
    'changelog_uri' => 'https://github.com/mongodb/mongo-ruby-driver/releases',
    'documentation_uri' => 'https://docs.mongodb.com/ruby-driver/',
    'homepage_uri' => 'https://docs.mongodb.com/ruby-driver/',
    'source_code_uri' => 'https://github.com/mongodb/mongo-ruby-driver',
  }

  if File.exist?('gem-private_key.pem')
    s.signing_key     = 'gem-private_key.pem'
    s.cert_chain      = ['gem-public_cert.pem']
  else
    warn "[#{s.name}] Warning: No private key present, creating unsigned gem."
  end

  s.files             = Dir.glob('{bin,lib,spec}/**/*')
  s.files             += %w[mongo.gemspec LICENSE README.md CONTRIBUTING.md Rakefile]
  s.test_files        = Dir.glob('spec/**/*')

  s.executables       = ['mongo_console']
  s.require_paths     = ['lib']
  s.bindir            = 'bin'

  s.required_ruby_version = ">= 2.3"

  s.add_dependency 'bson', '>=4.8.2', '<5.0.0'
end
@p-mongo p-mongo added the Bundler label Jul 9, 2020
@deivid-rodriguez
Copy link
Member

Agreed. I never found this error helpful.

@NeimadTL
Copy link
Contributor

@deivid-rodriguez , therefore should it be fixed by showing the actual error ?

@deivid-rodriguez
Copy link
Member

In my opinion, yes, I don't think the current level of indirection is helpful.

@deivid-rodriguez
Copy link
Member

I'm tentatively tagging this as "good first issue", even though things sometimes get harder than one expects 😅

@NeimadTL
Copy link
Contributor

appreciate it a lot @deivid-rodriguez ;)

@deivid-rodriguez
Copy link
Member

@p-mongo I fixed this in #4061.

Now you should get something like

Retrying fetcher due to error (2/4): Bundler::HTTPError Could not fetch specs from https://rubygems.org/ due to underlying error <Errno::ECONNREFUSED: Failed to open TCP connection to rubygems.org:443 (Connection refused - connect(2) for "rubygems.org" port 443) (https://rubygems.org/specs.4.8.gz)>
Retrying fetcher due to error (3/4): Bundler::HTTPError Could not fetch specs from https://rubygems.org/ due to underlying error <Errno::ECONNREFUSED: Failed to open TCP connection to rubygems.org:443 (Connection refused - connect(2) for "rubygems.org" port 443) (https://rubygems.org/specs.4.8.gz)>
Retrying fetcher due to error (4/4): Bundler::HTTPError Could not fetch specs from https://rubygems.org/ due to underlying error <Errno::ECONNREFUSED: Failed to open TCP connection to rubygems.org:443 (Connection refused - connect(2) for "rubygems.org" port 443) (https://rubygems.org/specs.4.8.gz)>
Could not fetch specs from https://rubygems.org/ due to underlying error <Errno::ECONNREFUSED: Failed to open TCP connection to rubygems.org:443 (Connection refused - connect(2) for "rubygems.org" port 443) (https://rubygems.org/specs.4.8.gz)>

@p-mongo
Copy link
Author

p-mongo commented Nov 16, 2020

👍 That looks great, thank you!

@deivid-rodriguez
Copy link
Member

I also added one further improvement at #4064.

@pre
Copy link

pre commented Oct 1, 2021

I have seen this issue when IPv6 connection has failed. By making IPv4 nameservers the primary in /etc/resolv.conf the connection was established. If IPv6 nameservers were the primary, connection failed today with:

Retrying fetcher due to error (2/4): Bundler::HTTPError Could not fetch specs from https://rubygems.org/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants