Skip to content

ENETRESET in remote_fetcher:api_endpoint on Windows 7 / ruby 2.2 / gems 2.4.5 #1214

Closed
@altmind

Description

@altmind

Using rubyinstaller to install Ruby 2.2.1-x86 on windows 7 x64 machine. No proxy configured, no firewalls active, no antivirus software installed. Plain direct connection to internet.

c:\work>ruby -v
ruby 2.2.1p85 (2015-02-26 revision 49769) [i386-mingw32]
c:\work>gem -v
2.4.5

Trying to execute any gem network operation fails with

c:\work>gem install --backtrace aws-sdk
ERROR:  While executing gem ... (Errno::ENETRESET)
    The connection has been broken due to keep-alive activity detecting a failure while the operation was in progress. - recvfrom(2)
        c:/Ruby22/lib/ruby/2.2.0/resolv.rb:759:in `recvfrom'
        c:/Ruby22/lib/ruby/2.2.0/resolv.rb:759:in `recv_reply'
        c:/Ruby22/lib/ruby/2.2.0/resolv.rb:690:in `request'
        c:/Ruby22/lib/ruby/2.2.0/resolv.rb:528:in `block in fetch_resource'
        c:/Ruby22/lib/ruby/2.2.0/resolv.rb:1096:in `block (3 levels) in resolv'
        c:/Ruby22/lib/ruby/2.2.0/resolv.rb:1094:in `each'
        c:/Ruby22/lib/ruby/2.2.0/resolv.rb:1094:in `block (2 levels) in resolv'
        c:/Ruby22/lib/ruby/2.2.0/resolv.rb:1093:in `each'
        c:/Ruby22/lib/ruby/2.2.0/resolv.rb:1093:in `block in resolv'
        c:/Ruby22/lib/ruby/2.2.0/resolv.rb:1091:in `each'
        c:/Ruby22/lib/ruby/2.2.0/resolv.rb:1091:in `resolv'
        c:/Ruby22/lib/ruby/2.2.0/resolv.rb:519:in `fetch_resource'
        c:/Ruby22/lib/ruby/2.2.0/resolv.rb:509:in `each_resource'
        c:/Ruby22/lib/ruby/2.2.0/resolv.rb:490:in `getresource'
        c:/Ruby22/lib/ruby/2.2.0/rubygems/remote_fetcher.rb:92:in `api_endpoint'
        c:/Ruby22/lib/ruby/2.2.0/rubygems/source.rb:46:in `api_uri'
        c:/Ruby22/lib/ruby/2.2.0/rubygems/source.rb:85:in `dependency_resolver_set'
        c:/Ruby22/lib/ruby/2.2.0/rubygems/resolver/best_set.rb:23:in `block in pick_sets'
        c:/Ruby22/lib/ruby/2.2.0/rubygems/source_list.rb:97:in `each'
        c:/Ruby22/lib/ruby/2.2.0/rubygems/source_list.rb:97:in `each_source'
        c:/Ruby22/lib/ruby/2.2.0/rubygems/resolver/best_set.rb:22:in `pick_sets'
        c:/Ruby22/lib/ruby/2.2.0/rubygems/resolver/best_set.rb:28:in `find_all'
        c:/Ruby22/lib/ruby/2.2.0/rubygems/resolver/installer_set.rb:151:in `find_all'
        c:/Ruby22/lib/ruby/2.2.0/rubygems/resolver/installer_set.rb:54:in `add_always_install'
        c:/Ruby22/lib/ruby/2.2.0/rubygems/dependency_installer.rb:463:in `resolve_dependencies'
        c:/Ruby22/lib/ruby/2.2.0/rubygems/commands/install_command.rb:238:in `install_gem'
        c:/Ruby22/lib/ruby/2.2.0/rubygems/commands/install_command.rb:299:in `block in install_gems'
        c:/Ruby22/lib/ruby/2.2.0/rubygems/commands/install_command.rb:295:in `each'
        c:/Ruby22/lib/ruby/2.2.0/rubygems/commands/install_command.rb:295:in `install_gems'
        c:/Ruby22/lib/ruby/2.2.0/rubygems/commands/install_command.rb:202:in `execute'
        c:/Ruby22/lib/ruby/2.2.0/rubygems/command.rb:307:in `invoke_with_build_args'
        c:/Ruby22/lib/ruby/2.2.0/rubygems/command_manager.rb:168:in `process_args'
        c:/Ruby22/lib/ruby/2.2.0/rubygems/command_manager.rb:138:in `run'
        c:/Ruby22/lib/ruby/2.2.0/rubygems/gem_runner.rb:54:in `run'
        c:/Ruby22/bin/gem:21:in `<main>'

This traces back to line https://github.com/rubygems/rubygems/blob/master/lib/rubygems/remote_fetcher.rb#L94

Maybe windows dns client cannot handle SRV requests(dunno, never looked into the cause of the problem)

This can be fixed if we replace rescue Resolv::ResolvError with plain rescue or more specific dns resolve error handling.

Activity

tenderlove

tenderlove commented on Apr 29, 2015

@tenderlove
Contributor

Wow, I've never seen that exception before. If you rescue Errno::ENETRESET, will it work?

cyberegg

cyberegg commented on May 19, 2015

@cyberegg

Corporate network, Mcafee (a/v only), no software firewalls, no proxies.
Windows 7 Ult x64
Ruby 2.1.6
Rubygems 2.4.7
gem install anything gave this same error
Tried all sorts of DNS, network, ruby troubleshooting.

Came down to one simple thing: turn the Windows firewall ON.

Turn it OFF, immediately able to reproduce error. Turn it ON and the gems start flowing again. GO FIGURE.

Exact same computer hardware/software build right next to it, no issues retrieving gems with the M$ firewall up or down. Chalking this up to "user customization" of their workstation.

"Nuke it from orbit... only way to be sure." -Hicks

altmind

altmind commented on May 19, 2015

@altmind
Author

@tenderlove indeed rescue Errno::ENETRESET worked. canot retest it, thou.

djberg96

djberg96 commented on May 24, 2015

@djberg96
Contributor

I disabled my firewall, but was unable to reproduce this error. I tried various firewall configurations, too. Personally I'd blame McAfee. ;)

Anyway, closing this one out as "unable to reproduce".

aleksey-korolev

aleksey-korolev commented on Nov 22, 2015

@aleksey-korolev

Reproducing it right now on Windows 7 Ult x64 SP1
ruby 2.2.1p85
gem install/update anything gives this error
Have Avast Free Antivirus, diabling it doesn't help. Windows Firewall is off.
Updating to ruby to 2.2.3 doesn't help.
ruby -v
2.2.3p173 (2015-08-18 revision 51636) [x64-mingw32]
Ruby on Windows is pain...

aleksey-korolev

aleksey-korolev commented on Nov 25, 2015

@aleksey-korolev

Tried same command using same notebook with same software but from another location with another internet provider and the command worked fine, so it might be network infrastructure related thing like MTU size somewhere on a router:

D:\Work>gem update rhc
Updating installed gems
Updating rhc
Fetching: rhc-1.38.4.gem (100%)

If this is your first time installing the RHC tools, please run 'rhc setup'

Successfully installed rhc-1.38.4
Parsing documentation for rhc-1.38.4
Installing ri documentation for rhc-1.38.4
Installing darkfish documentation for rhc-1.38.4
Done installing documentation for rhc after 7 seconds
Parsing documentation for rhc-1.38.4
Done installing documentation for rhc after 3 seconds
Gems updated: rhc

bezaworkmetropolia

bezaworkmetropolia commented on Nov 26, 2015

@bezaworkmetropolia

@cyberegg ur method worked for me

rioux602

rioux602 commented on Mar 2, 2016

@rioux602

@cyberegg Thanks!!!

Stromweld

Stromweld commented on Apr 24, 2016

@Stromweld

I also found @cyberegg's trick to work. I also found that 2 of my machines were in vmware that were running into this same issue and swapping out the vm nic from intel E1000 to vmxnet3 also fixed this issue with the firewall turned off.

vivekm2017

vivekm2017 commented on Sep 22, 2016

@vivekm2017

I was running- "gem install berkshelf", I got the same error. So when I ran "gem install bundle" first and then tried the "gem install berkshelf" - it worked!!

BoraDev

BoraDev commented on Dec 10, 2016

@BoraDev

Same here guys. I turned Windows Firewall ON,and it works. How is this possible I don't know. Anyway, @cyberegg ,thanks a lot.

ppjuns

ppjuns commented on Apr 23, 2017

@ppjuns

@cyberegg ,thx it worked for me ,I try the method three times ,after reborn my pc and permit the firewall tip window ,finally it run successfully.

renaatdemuynck

renaatdemuynck commented on Oct 2, 2017

@renaatdemuynck

I had the same problem. Fixed by temporarily disabling my anti-virus (Symantec Endpoint Protection).

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @tenderlove@djberg96@altmind@vivekm2017@aleksey-korolev

        Issue actions

          ENETRESET in remote_fetcher:api_endpoint on Windows 7 / ruby 2.2 / gems 2.4.5 · Issue #1214 · rubygems/rubygems