Running into " Errno::EMFILE: Too many open files - socket(2)" while installing any gem

SBhat's Avatar

SBhat

10 Jan, 2014 11:58 AM

Hi,

I'm running windows7 Enterprise and have been working with Rails 2.3.1 for a while. The app I'm working on uses paperclip 3.3.1.

I was working on a page that modifies the table where image meta is stored and as each row got modified, in the background paperclip was saving attachments. I could see it in the dev log. One fine day suddenly this error came up when I tried to bring my server up and I haven't been able to get rid of it ever since.
I uninstalled rails and ruby, and I reinstalled ruby using the one click installer. I also installed and associated DevKit, as before.
Now I'm trying to reinstall the gems I had. As a first step, I tried to install a gem manually and ran into the same error.

C:\DevKit>gem install bundler
ERROR: Could not find a valid gem 'bundler' (>= 0) in any repository
ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError)
Errno::EMFILE: Too many open files - socket(2) (http://rubygems.org/latest_s pecs.4.8.gz)

C:\DevKit>gem install json --platform=ruby
ERROR: Could not find a valid gem 'json' (>= 0) in any repository
ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError)
Errno::EMFILE: Too many open files - socket(2) (http://rubygems.org/latest_s pecs.4.8.gz)

Info about my environment:

C:\DevKit>gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.23 - RUBY VERSION: 1.9.3 (2012-04-20 patchlevel 194) [i386-mingw32] - INSTALLATION DIRECTORY: C:/Ruby193/lib/ruby/gems/1.9.1 - RUBY EXECUTABLE: C:/Ruby193/bin/ruby.exe - EXECUTABLE DIRECTORY: C:/Ruby193/bin - RUBYGEMS PLATFORMS: - ruby - x86-mingw32 - GEM PATHS: - C:/Ruby193/lib/ruby/gems/1.9.1 - C:/Users/Suma.Bhat.RMED0058LT/.gem/ruby/1.9.1 - GEM CONFIGURATION: - :update_sources => true - :verbose => true - :benchmark => false - :backtrace => false - :bulk_threshold => 1000 - REMOTE SOURCES: - http://rubygems.org/

C:\DevKit>gem install rails -V
Error fetching remote data: Errno::EMFILE: Too many open files - soc
ket(2) (http://rubygems.org/latest_specs.4.8.gz)
Falling back to local-only install
ERROR: Could not find a valid gem 'rails' (>= 0) in any repository
ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError)
Errno::EMFILE: Too many open files - socket(2) (http://rubygems.org/latest_s pecs.4.8.gz)

Any pointers/ help will be greatly appreciated.
Thanks.

  1. Support Staff 1 Posted by Luis Lavena on 10 Jan, 2014 12:07 PM

    Luis Lavena's Avatar

    Hello,

    Are you behind a proxy? have you set HTTP_PROXY environment variable? seems
    you're not using it with install parameter like --http-proxy

    The version of Rails, Ruby or what you're doing with your application might
    not be as relevant as your computer environment.

    Any antivirus software you have installed? Any network blocker or limiter
    like Peerblock installed and/or running?

    A few recommendations:

    Update to latest version of RubyGems for that series of ruby, please run:

    gem update --system 1.8.29

    Once the updated version is installed, please try gem installation again.

    Second recommendation: change the sources to use https instead of http (e.g
    https://rubygems.org)

    Next, please attempt to install a single gem again with --debug -V options:

    gem install rails --debug -V

    Then place the entire output of that into a gist (https://gist.github.com/)
    and link to it when you reply.

    Cheers.

  2. 2 Posted by SBhat on 10 Jan, 2014 01:51 PM

    SBhat's Avatar

    Hi,

    Thanks for the pointers.
    HTTP_PROXY environment variable is not set. There is no antivirun installed other than Microsoft Security Essentials. There is no network blocker/limiter installed or running.
    I had a sysadmin take a look it my computer and confirm the above. I'm running a full scan to check if there's any malware. Will keep you posted.

    I'm unable to update ruby gems. Same error pops up.
    https://gist.github.com/anonymous/1376b19269965af5ea06
    https://gist.github.com/anonymous/1ed80c96a47549aa75a5

  3. 3 Posted by SBhat on 13 Jan, 2014 11:06 AM

    SBhat's Avatar

    It turns out my computer was infected. After the clean up, I'm able to install gems.

    Thanks for the tips!

  4. Nick Quaranto closed this discussion on 06 Mar, 2014 03:04 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac